rails-bigint-pk 0.0.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e59b399aa72f4fc1bc410101c6b9fe7e86c1902f
4
- data.tar.gz: b05791c30141695f0a851c0bdc86698dd3cf1472
3
+ metadata.gz: dc794aae7fc04ee85d379ac5433c4b2f37fa8cb3
4
+ data.tar.gz: f9bf0242a1c54f6ff5b8c98831dce75d6ee51c20
5
5
  SHA512:
6
- metadata.gz: 0195a8da8a39a28d3823cf661a895f60c8ff97df6b3eac8ba873e198e4126d057526d3b391179e332643377a32f0bdec6bc27e8919dc51a1e25034843beebea0
7
- data.tar.gz: 935ba4cd1407b3b8bb9f8b6a10b0aa6a6c8581055210ce25585787ce4498a5f98e0a51cf4cf04607dec61367f6468fd6993be33aa63e5e25be6edde19e476fc4
6
+ metadata.gz: 203ac729e7904234a26259da6a85974237a5d59609dab04dc6e6fd6ede45c0b842dff3a35c053e79854826ccb3b3aef6db6695c298111cffb7d0517dde51b8e8
7
+ data.tar.gz: e5514062891c3099206de073d7a45b9d2bb2eeede579744bfc6108592b97f3894337d8493b18f94f3de301264aeb0197a60a00976b3dc7d931da89acc240e5c2
@@ -1 +1 @@
1
- ruby-1.9.3-p484
1
+ ruby-2.1.1
data/Changelog CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.0.0 (21 April 2014)
2
+
3
+ New Features:
4
+ - Rails 4 support (tested with 4.0.4)
5
+
6
+
1
7
  ## 0.0.3 (02 March 2014)
2
8
  - move project from VerticalResponse to caboteria (VerticalResponse went offline)
3
9
  - update rails to 3.2.17
data/Readme.md CHANGED
@@ -2,23 +2,49 @@
2
2
 
3
3
  ### Overview
4
4
 
5
- rails-bigint-pk aims to be a simple, transparent way to use 64bit primary keys
6
- in mysql and postgres.
5
+ rails-bigint-pk is a simple, transparent way to use 64bit primary keys
6
+ in MySQL and PostgreSQL.
7
7
 
8
8
  ### Requirements
9
9
 
10
- rails-bigint-pk has been tested with rails 3.2.17, which at the time of writing
11
- is the latest patch version for 3.2. If you use a higher patch version, it is
10
+ rails-bigint-pk has been tested with rails 4.0.4, which at the time of writing
11
+ is the latest patch version for 4.0. If you use a higher patch version, it is
12
12
  recommended to run the test suite against your version of rails and activerecord.
13
13
 
14
14
  ### Installation & Usage
15
15
 
16
- rails-bigint-pk has a `rails3` branch for support of 3.2.x versions of
17
- Rails. The `master` branch supports Rails 4. To install the rails3
18
- version, you can either download releases from Rubygems by adding the
19
- following to your `Gemfile`:
20
- `gem 'rails-bigint-pk', '~>0.0.1'`
16
+ #### Rails 4
17
+
18
+ rails-bigint-pk supports Rails 4. To install, you can either
19
+ download releases from Rubygems by adding the following to your
20
+ `Gemfile`:
21
+
22
+ `gem 'rails-bigint-pk', '~>1.0.0'`
23
+
21
24
  ... or you can install the newest code directly from git:
25
+
26
+ `gem 'rails-bigint-pk', github: 'caboteria/rails-bigint-pk'`
27
+
28
+ Then run the generator:
29
+ `rails generate bigint_pk:install`
30
+
31
+ This will create an initializer that enables 64 bit primary and foreign keys by
32
+ changing the default primary key type, and using `limit: 8` for foreign keys
33
+ created via `references`.
34
+
35
+ It will also create a migration to update all existing primary and foreign keys.
36
+
37
+ #### Rails 3
38
+
39
+ There is a `rails3` branch for support of 3.2.x versions of Rails. To
40
+ install, you can either download 0.0.x releases from Rubygems by
41
+ adding the following to your `Gemfile`:
42
+
43
+ `gem 'rails-bigint-pk', '~>0.0.1'`
44
+
45
+ ... or you can install the newest rails3 branch code directly from
46
+ git:
47
+
22
48
  `gem 'rails-bigint-pk', github: 'caboteria/rails-bigint-pk', branch: 'rails3'`
23
49
 
24
50
  Then run the generator:
@@ -63,6 +63,8 @@ module BigintPk
63
63
  references_without_default_bigint_fk( *args, options )
64
64
  end
65
65
  alias_method_chain :references, :default_bigint_fk
66
+ alias_method :belongs_to_without_default_bigint_fk, :belongs_to
67
+ alias_method :belongs_to, :references_with_default_bigint_fk
66
68
  end
67
69
  end
68
70
  end
@@ -1,3 +1,3 @@
1
1
  module BigintPk
2
- VERSION = "0.0.3"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -5,7 +5,7 @@ class ChangeKeysToBigint < ActiveRecord::Migration
5
5
  def change
6
6
  Rails.application.eager_load!
7
7
  ActiveRecord::Base.subclasses.select do |type|
8
- connection.table_exists? type.table_name
8
+ type.primary_key.present? and connection.table_exists? type.table_name
9
9
  end.each do |type|
10
10
  BigintPk.update_primary_key type.table_name, type.primary_key
11
11
 
@@ -9,28 +9,32 @@ Gem::Specification.new do |s|
9
9
  s.email = ["github@hjdivad.com"]
10
10
  s.homepage = "https://github.com/caboteria/rails-bigint-pk"
11
11
  s.summary = %q{Easily use 64-bit primary keys in rails}
12
- s.description = %q{Easily use 64-bit primary keys in rails}
13
-
14
- s.rubyforge_project = "rails-bigint-pk"
12
+ s.description = <<-DESC
13
+ Rails-bigint-pk modifies Rails so that it uses
14
+ 64-bit primary and foreign keys. It works with
15
+ MySQL and PostgreSQL and has versions for Rails
16
+ 3 and 4.
17
+ DESC
18
+ s.licenses = ['MIT']
15
19
 
16
20
  s.files = `git ls-files`.split("\n")
17
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
23
  s.require_paths = ["lib"]
20
24
 
21
- s.add_runtime_dependency "activerecord", '~> 3.2.0'
22
- s.add_runtime_dependency "railties", '~> 3.2.0'
25
+ s.add_runtime_dependency "activerecord", '~> 4.0.0'
26
+ s.add_runtime_dependency "railties", '~> 4.0.0'
23
27
 
24
- s.add_development_dependency "rspec"
25
- s.add_development_dependency "travis-lint"
26
- s.add_development_dependency "rails"
27
- s.add_development_dependency "mysql2", '~> 0.3.10'
28
- s.add_development_dependency "mysql", '~> 2.8.1'
28
+ s.add_development_dependency "rspec", '~> 2.14'
29
+ s.add_development_dependency "travis-lint", '~> 1.7'
30
+ s.add_development_dependency "rails", '~> 4.0'
31
+ s.add_development_dependency "mysql2", '~> 0.3'
32
+ s.add_development_dependency "mysql", '~> 2.8'
29
33
  s.add_development_dependency "pg", '~> 0.11'
30
- s.add_development_dependency "sqlite3", '~> 1.3.6'
31
- s.add_development_dependency "guard"
32
- s.add_development_dependency "guard-rspec"
33
- s.add_development_dependency "guard-bundler"
34
- s.add_development_dependency "guard-ctags-bundler"
35
- s.add_development_dependency "rb-fsevent"
34
+ s.add_development_dependency "sqlite3", '~> 1.3'
35
+ s.add_development_dependency "guard", '~>2.5'
36
+ s.add_development_dependency "guard-rspec", '~> 4.2'
37
+ s.add_development_dependency "guard-bundler", '~> 2.0'
38
+ s.add_development_dependency "guard-ctags-bundler", '~> 1.0'
39
+ s.add_development_dependency "rb-fsevent", '~> 0.9'
36
40
  end
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '3.2.17'
3
+ gem 'rails', '4.0.4'
4
4
 
5
5
  gem 'pg', '~> 0.11'
6
6
  gem 'mysql', '~> 2.8.1'
@@ -10,7 +10,7 @@ describe BigintPk::Generators::InstallGenerator, :integration do
10
10
  end
11
11
 
12
12
  it 'creates a bigint_pk initializer' do
13
- expect( File.exists? "#{RailsDir}/config/initializers/bigint_pk.rb").to be_true
13
+ expect(File.exists? "#{RailsDir}/config/initializers/bigint_pk.rb")
14
14
  end
15
15
 
16
16
  it 'creates a bigint_pk migration' do
@@ -12,6 +12,8 @@ describe BigintPk do
12
12
  end
13
13
  end
14
14
  end
15
+ ActiveRecord::ConnectionHandling.send :remove_const, :VALID_CONN_PARAMS
16
+ load 'active_record/connection_adapters/postgresql/referential_integrity.rb'
15
17
  load 'active_record/connection_adapters/postgresql_adapter.rb'
16
18
  load 'active_record/connection_adapters/abstract_mysql_adapter.rb'
17
19
  end
@@ -63,12 +65,19 @@ describe BigintPk do
63
65
  context 'when a limit is not specified' do
64
66
  let(:options){}
65
67
 
66
- it 'defaults the limit to 8' do
68
+ it 'defaults the references limit to 8' do
67
69
  abstract_table.should_receive(:references_without_default_bigint_fk).with(
68
70
  'some_other_table', hash_including( limit: 8 )
69
71
  )
70
72
  abstract_table.references *args
71
73
  end
74
+
75
+ it 'defaults the belongs_to limit to 8' do
76
+ abstract_table.should_receive(:references_without_default_bigint_fk).with(
77
+ 'some_other_table', hash_including( limit: 8 )
78
+ )
79
+ abstract_table.belongs_to *args
80
+ end
72
81
  end
73
82
 
74
83
  context 'when reference is polymorphic' do
@@ -110,7 +119,7 @@ describe BigintPk do
110
119
 
111
120
  describe ActiveRecord::ConnectionAdapters::Table do
112
121
  let(:abstract_table_class){ ActiveRecord::ConnectionAdapters::TableDefinition }
113
- let(:abstract_table){ abstract_table_class.new Object.new }
122
+ let(:abstract_table){ abstract_table_class.new({}, "table", {}, {}) }
114
123
  it_makes_references_default_to_64bit
115
124
  end
116
125
 
@@ -40,7 +40,6 @@ RSpec.configure do |c|
40
40
  "#{RailsDir}/#{dir}"
41
41
  end
42
42
 
43
- run "bundle install --binstubs"
44
43
  run "git init && git add . && git commit -m 'Root'"
45
44
  end
46
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-bigint-pk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David J. Hamilton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-02 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,98 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.0
19
+ version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.0
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.0
33
+ version: 4.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.2.0
40
+ version: 4.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '2.14'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: travis-lint
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.7'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.7'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '4.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '4.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mysql2
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.3.10
89
+ version: '0.3'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.3.10
96
+ version: '0.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mysql
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 2.8.1
103
+ version: '2.8'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.8.1
110
+ version: '2.8'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pg
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,85 +128,89 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.3.6
131
+ version: '1.3'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.3.6
138
+ version: '1.3'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: guard
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: '2.5'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0'
152
+ version: '2.5'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: guard-rspec
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: '4.2'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '4.2'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: guard-bundler
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: '2.0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: '2.0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: guard-ctags-bundler
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: '1.0'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ">="
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '0'
194
+ version: '1.0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rb-fsevent
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ">="
199
+ - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0'
201
+ version: '0.9'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ">="
206
+ - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0'
209
- description: Easily use 64-bit primary keys in rails
208
+ version: '0.9'
209
+ description: |2
210
+ Rails-bigint-pk modifies Rails so that it uses
211
+ 64-bit primary and foreign keys. It works with
212
+ MySQL and PostgreSQL and has versions for Rails
213
+ 3 and 4.
210
214
  email:
211
215
  - github@hjdivad.com
212
216
  executables: []
@@ -251,7 +255,8 @@ files:
251
255
  - spec/support/rails.rb
252
256
  - spec/support/rspec.rb
253
257
  homepage: https://github.com/caboteria/rails-bigint-pk
254
- licenses: []
258
+ licenses:
259
+ - MIT
255
260
  metadata: {}
256
261
  post_install_message:
257
262
  rdoc_options: []
@@ -268,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
273
  - !ruby/object:Gem::Version
269
274
  version: '0'
270
275
  requirements: []
271
- rubyforge_project: rails-bigint-pk
276
+ rubyforge_project:
272
277
  rubygems_version: 2.2.2
273
278
  signing_key:
274
279
  specification_version: 4