rails-bigint-pk 1.0.0 → 1.1.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: dc794aae7fc04ee85d379ac5433c4b2f37fa8cb3
4
- data.tar.gz: f9bf0242a1c54f6ff5b8c98831dce75d6ee51c20
3
+ metadata.gz: 36f312ba8a2d027d656428d951776d19cfa558b2
4
+ data.tar.gz: 6170eacf81c9e50fa0bced8a4f3af2c266ea1197
5
5
  SHA512:
6
- metadata.gz: 203ac729e7904234a26259da6a85974237a5d59609dab04dc6e6fd6ede45c0b842dff3a35c053e79854826ccb3b3aef6db6695c298111cffb7d0517dde51b8e8
7
- data.tar.gz: e5514062891c3099206de073d7a45b9d2bb2eeede579744bfc6108592b97f3894337d8493b18f94f3de301264aeb0197a60a00976b3dc7d931da89acc240e5c2
6
+ metadata.gz: 5069efd0eacefd9158538aa17a553a1ddf6334ecf46bfeef283e5e71449c729a38cbbe21304bfeecccf9b2be8ce38f6b42eed3abfd6b2f117dcdf44e44ef20ce
7
+ data.tar.gz: 08e4ef35607b17997e538e3bf23e537902c115f76d4e2da79d2c5646de873b0fc70c79fe9c3f1d32f13b3b367ecdbe204e57e78225f40eda6c1b5cf31696d99b
data/Changelog CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.1.0 (20 May 2014)
2
+
3
+ Improvement:
4
+ - Rails 4.1 support:
5
+ Changes corresponding to changes in Rails 4.1 to support MySQL 5.7.3
6
+ Thanks, @Bishop!
7
+
8
+
1
9
  ## 1.0.0 (21 April 2014)
2
10
 
3
11
  New Features:
data/Readme.md CHANGED
@@ -15,13 +15,13 @@ recommended to run the test suite against your version of rails and activerecord
15
15
 
16
16
  #### Rails 4
17
17
 
18
- rails-bigint-pk supports Rails 4. To install, you can either
18
+ rails-bigint-pk supports Rails 4 and 4.1. To install, you can either
19
19
  download releases from Rubygems by adding the following to your
20
20
  `Gemfile`:
21
21
 
22
- `gem 'rails-bigint-pk', '~>1.0.0'`
22
+ `gem 'rails-bigint-pk', '~>1.1.0'`
23
23
 
24
- ... or you can install the newest code directly from git:
24
+ ... or, if you enjoy being on the bleeding edge, you can install the newest code directly from git:
25
25
 
26
26
  `gem 'rails-bigint-pk', github: 'caboteria/rails-bigint-pk'`
27
27
 
@@ -39,8 +39,7 @@ module BigintPk
39
39
  end
40
40
 
41
41
  if ca.const_defined? :AbstractMysqlAdapter
42
- ca::AbstractMysqlAdapter::NATIVE_DATABASE_TYPES[:primary_key] =
43
- 'bigint(20) DEFAULT NULL auto_increment PRIMARY KEY'
42
+ ca::AbstractMysqlAdapter::NATIVE_DATABASE_TYPES[:primary_key].gsub! /int\(11\)/, 'bigint(20)'
44
43
  end
45
44
  end
46
45
 
@@ -83,7 +82,7 @@ module BigintPk
83
82
  c.execute %Q{
84
83
  ALTER TABLE #{c.quote_table_name table_name}
85
84
  MODIFY COLUMN #{c.quote_column_name key_name}
86
- bigint(20) DEFAULT NULL #{'auto_increment' if is_primary_key}
85
+ bigint(20) #{is_primary_key ? 'auto_increment' : 'DEFAULT NULL'}
87
86
  }.gsub(/\s+/, ' ').strip
88
87
  when 'SQLite'
89
88
  # noop; sqlite always has 64bit pkeys
@@ -1,3 +1,3 @@
1
1
  module BigintPk
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -22,12 +22,12 @@ Gem::Specification.new do |s|
22
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
23
  s.require_paths = ["lib"]
24
24
 
25
- s.add_runtime_dependency "activerecord", '~> 4.0.0'
26
- s.add_runtime_dependency "railties", '~> 4.0.0'
25
+ s.add_runtime_dependency "activerecord", '>= 4.0', '< 4.2'
26
+ s.add_runtime_dependency "railties", '>= 4.0', '< 4.2'
27
27
 
28
28
  s.add_development_dependency "rspec", '~> 2.14'
29
29
  s.add_development_dependency "travis-lint", '~> 1.7'
30
- s.add_development_dependency "rails", '~> 4.0'
30
+ s.add_development_dependency "rails", '~> 4.1'
31
31
  s.add_development_dependency "mysql2", '~> 0.3'
32
32
  s.add_development_dependency "mysql", '~> 2.8'
33
33
  s.add_development_dependency "pg", '~> 0.11'
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '4.0.4'
3
+ gem 'rails', '4.1.1'
4
4
 
5
5
  gem 'pg', '~> 0.11'
6
6
  gem 'mysql', '~> 2.8.1'
@@ -31,6 +31,7 @@ describe 'ChangeKeysToBigint' do
31
31
 
32
32
  stub_const('Rails', double('Rails'))
33
33
  Rails.stub_chain 'application.eager_load!'
34
+ Rails.stub(env: double('test', to_s: 'test', :'test?' => true, :'production?' => false, :'development?' => false))
34
35
 
35
36
  ActiveRecord::Base.stub( subclasses: [ Team, Player, Coach ], connection: connection)
36
37
  ActiveRecord::Base.stub_chain('connection_pool.with_connection') do |&prok|
@@ -71,9 +72,9 @@ describe 'ChangeKeysToBigint' do
71
72
  it 'migrates primary keys' do
72
73
  ChangeKeysToBigint.migrate :up
73
74
  expect( queries ).to include(
74
- 'ALTER TABLE `teams` MODIFY COLUMN `id` bigint(20) DEFAULT NULL auto_increment',
75
- 'ALTER TABLE `players` MODIFY COLUMN `id` bigint(20) DEFAULT NULL auto_increment',
76
- 'ALTER TABLE `coaches` MODIFY COLUMN `id` bigint(20) DEFAULT NULL auto_increment'
75
+ 'ALTER TABLE `teams` MODIFY COLUMN `id` bigint(20) auto_increment',
76
+ 'ALTER TABLE `players` MODIFY COLUMN `id` bigint(20) auto_increment',
77
+ 'ALTER TABLE `coaches` MODIFY COLUMN `id` bigint(20) auto_increment'
77
78
  )
78
79
  end
79
80
 
@@ -2,6 +2,9 @@ require 'spec_helper'
2
2
  require 'active_record/connection_adapters/postgresql_adapter'
3
3
  require 'active_record/connection_adapters/abstract_mysql_adapter'
4
4
 
5
+ MYSQL_DEFAULT_PK = ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::NATIVE_DATABASE_TYPES[:primary_key]
6
+ PG_DEFAULT_PK = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:primary_key]
7
+
5
8
  describe BigintPk do
6
9
  describe '::setup' do
7
10
  def reset_connection_adapters!
@@ -41,7 +44,7 @@ describe BigintPk do
41
44
  expect(
42
45
  ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::
43
46
  NATIVE_DATABASE_TYPES[:primary_key]
44
- ).to eq 'bigint(20) DEFAULT NULL auto_increment PRIMARY KEY'
47
+ ).to match /bigint\(20\) (DEFAULT NULL )?auto_increment PRIMARY KEY/
45
48
  end
46
49
 
47
50
  def self.it_makes_references_default_to_64bit
@@ -144,14 +147,14 @@ describe BigintPk do
144
147
  expect(
145
148
  ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::
146
149
  NATIVE_DATABASE_TYPES[:primary_key]
147
- ).to eq 'serial primary key'
150
+ ).to eq PG_DEFAULT_PK
148
151
  end
149
152
 
150
153
  it 'does not alter the default primary key for either mysql adapters' do
151
154
  expect(
152
155
  ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::
153
156
  NATIVE_DATABASE_TYPES[:primary_key]
154
- ).to eq 'int(11) DEFAULT NULL auto_increment PRIMARY KEY'
157
+ ).to eq MYSQL_DEFAULT_PK
155
158
  end
156
159
  end
157
160
  end
metadata CHANGED
@@ -1,43 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-bigint-pk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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-04-21 00:00:00.000000000 Z
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 4.0.0
22
+ version: '4.2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: 4.0.0
29
+ version: '4.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: railties
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: 4.0.0
39
+ version: '4.0'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '4.2'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: 4.0.0
49
+ version: '4.0'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '4.2'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: rspec
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +84,14 @@ dependencies:
72
84
  requirements:
73
85
  - - "~>"
74
86
  - !ruby/object:Gem::Version
75
- version: '4.0'
87
+ version: '4.1'
76
88
  type: :development
77
89
  prerelease: false
78
90
  version_requirements: !ruby/object:Gem::Requirement
79
91
  requirements:
80
92
  - - "~>"
81
93
  - !ruby/object:Gem::Version
82
- version: '4.0'
94
+ version: '4.1'
83
95
  - !ruby/object:Gem::Dependency
84
96
  name: mysql2
85
97
  requirement: !ruby/object:Gem::Requirement
@@ -297,3 +309,4 @@ test_files:
297
309
  - spec/support/logging.rb
298
310
  - spec/support/rails.rb
299
311
  - spec/support/rspec.rb
312
+ has_rdoc: