webdack-uuid_migration 1.0.2 → 1.0.3

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: 7e73ae10fca41d84505cb6f9237f9b45f2da850c
4
- data.tar.gz: 5abb88d0a9bc06de553e2e7b1e6fcae13fc85d88
3
+ metadata.gz: 8940b7a9083a5b6ceeff3024f71b6d4ed26458df
4
+ data.tar.gz: fe7ad3d82d1b173fbae6cacb00e025b51f3b08ab
5
5
  SHA512:
6
- metadata.gz: d3005d3ba1bde0da93c33714b05cc7d831ede40dc91a977c836442c5b7be10f0a08e2d7a58fcf878e21fb1fafef26cc9b8d86ece4978270b1c49034a3824e8a9
7
- data.tar.gz: 1631e47e420df4926c7ce6ab4775925cf7a3f53389c7369a4d473cda7e63febdb0fb6782995da3ff786b4947ed0092123835b5d1851309c7f46e2a52ec1d531a
6
+ metadata.gz: 9367f618d3fbf87204eb060dada5bae50d75b289b34c5cd7c0810e476374fe51bb8c3a37ca8066ce272c659119a40a330d0dcf350087dd54bfb9669eb06ebc2f
7
+ data.tar.gz: b1f5bc8c89eb9b2d9b05bb643ef41e7383af154f5964b24403b4ff494b726fe6b4457d63a0311072f59443f7d8334b51e790f924b60b8a8342f8bc9f059da6b2
data/.travis.yml CHANGED
@@ -1,15 +1,18 @@
1
1
  rvm:
2
2
  - 1.9.3
3
3
  - 2.0.0
4
- - 2.1.1
5
- - 2.2.0
4
+ - 2.1.10
5
+ - 2.2.5
6
6
  - 2.3.1
7
- - rbx-2
8
- - jruby
9
- - ruby-head
7
+
8
+ gemfile:
9
+ - gemfiles/rails40.gemfile
10
+ - gemfiles/rails41.gemfile
11
+ - gemfiles/rails42.gemfile
10
12
 
11
13
  script: bundle exec rspec spec
12
14
 
13
15
  matrix:
14
- allow_failures:
15
- - rvm: jruby
16
+ include:
17
+ - rvm: 2.3.1
18
+ gemfile: gemfiles/rails50.gemfile
data/README.md CHANGED
@@ -66,6 +66,8 @@ into {ActiveRecord::Migration}, so that all methods can directly be used within
66
66
 
67
67
  Please see [https://github.com/kreatio-sw/webdack-uuid_migration/issues/4]
68
68
 
69
+ This function will only work with Rails 4.2 or newer.
70
+
69
71
  To update a primary key and all columns referencing it please use
70
72
  {Webdack::UUIDMigration::Helpers#primary_key_and_all_references_to_uuid}. For example:
71
73
 
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activerecord", "~>4.0.0"
4
+
5
+ gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activerecord", "~>4.1.0"
4
+
5
+ gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activerecord", "~>4.2.0"
4
+
5
+ gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activerecord", "~>5.0.0"
4
+
5
+ gemspec :path=>"../"
@@ -88,8 +88,9 @@ module Webdack
88
88
  # - Restore all foreign keys
89
89
  #
90
90
  # @param table[Symbol]
91
+ # @note Works only with Rails 4.2 or newer
91
92
  def primary_key_and_all_references_to_uuid(table)
92
- fk_specs = foreign_keys_into(:cities)
93
+ fk_specs = foreign_keys_into(table)
93
94
 
94
95
  drop_foreign_keys(fk_specs)
95
96
 
@@ -2,6 +2,6 @@
2
2
  module Webdack
3
3
  #
4
4
  module UUIDMigration
5
- VERSION = "1.0.2"
5
+ VERSION = "1.0.3"
6
6
  end
7
7
  end
@@ -4,7 +4,7 @@ ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
4
4
  include Webdack::UUIDMigration::SchemaHelpers
5
5
  end
6
6
 
7
- describe Webdack::UUIDMigration::SchemaHelpers do
7
+ describe Webdack::UUIDMigration::SchemaHelpers, rails_4_2_or_newer: true do
8
8
  def initial_setup
9
9
  init_database
10
10
  create_initial_schema
@@ -25,25 +25,25 @@ describe Webdack::UUIDMigration::SchemaHelpers do
25
25
  it 'should get all foreign keys into a table' do
26
26
  foreign_keys_into = @connection.foreign_keys_into(:cities)
27
27
 
28
+ # Remove column :name from the FK info
29
+ foreign_keys_into = foreign_keys_into.map { |i| i.delete(:name); i }
30
+
28
31
  expect(foreign_keys_into).to eq([{:to_table => "cities",
29
32
  :primary_key => "id",
30
33
  :from_table => "dummy01",
31
34
  :column => "city_id",
32
- :name => "fk_rails_d0b87897d5",
33
35
  :on_delete => :nullify,
34
36
  :on_update => :cascade},
35
37
  {:to_table => "cities",
36
38
  :primary_key => "id",
37
39
  :from_table => "dummy02",
38
40
  :column => "city_id",
39
- :name => "fk_rails_bc0a81611b",
40
41
  :on_delete => :restrict,
41
42
  :on_update => :restrict},
42
43
  {:to_table => "cities",
43
44
  :primary_key => "id",
44
45
  :from_table => "students",
45
46
  :column => "city_id",
46
- :name => "fk_rails_c4b8171c0a",
47
47
  :on_delete => nil,
48
48
  :on_update => nil}])
49
49
  end
data/spec/spec_helper.rb CHANGED
@@ -6,3 +6,9 @@ require 'pg'
6
6
  require 'webdack/uuid_migration/helpers'
7
7
 
8
8
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
9
+
10
+ RSpec.configure do |c|
11
+ if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('4.2')
12
+ c.filter_run_excluding rails_4_2_or_newer: true
13
+ end
14
+ end
@@ -170,7 +170,7 @@ describe Webdack::UUIDMigration::Helpers do
170
170
  }
171
171
  end
172
172
 
173
- it 'should migrate a primary key and all columns referencing it using foreign keys' do
173
+ it 'should migrate a primary key and all columns referencing it using foreign keys', rails_4_2_or_newer: true do
174
174
  # Create 2 more tables similar to the way new version of Rails will do
175
175
  create_tables_with_fk
176
176
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdack-uuid_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepak Kumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-09 00:00:00.000000000 Z
11
+ date: 2016-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,10 @@ files:
122
122
  - LICENSE.txt
123
123
  - README.md
124
124
  - Rakefile
125
+ - gemfiles/rails40.gemfile
126
+ - gemfiles/rails41.gemfile
127
+ - gemfiles/rails42.gemfile
128
+ - gemfiles/rails50.gemfile
125
129
  - lib/webdack/uuid_migration.rb
126
130
  - lib/webdack/uuid_migration/helpers.rb
127
131
  - lib/webdack/uuid_migration/schema_helpers.rb