declare_schema 1.2.3.pre.ga.6 → 1.2.3.pre.ga.7
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 308421d49ba0007340aad10be1ca95b4798d1c3a98c3e7bb52e41d81f903530e
|
4
|
+
data.tar.gz: 7e1c75911502f841c935308a8b1f8a8997702839eb348f07b45eee05cc3440b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e4d907b428190cdb3cfa5b99c27e9a751a110144092e9498888b79a5050596bb849afb73feb38d6f4bba73617f4a3d00e0c8d4cde9634c124472f93a5003022
|
7
|
+
data.tar.gz: 1774ac3658dccd0f32f280b04358cfa80707053d8d595b3527f467e97c8b91f66651de3737fea969abd01c2454bc028aca12ae98380e7a1d76d0ef4dc0a37eb5
|
data/Gemfile.lock
CHANGED
@@ -446,7 +446,7 @@ module Generators
|
|
446
446
|
if !ActiveRecord::Base.connection.class.name.match?(/SQLite3Adapter/)
|
447
447
|
change_primary_key =
|
448
448
|
if (existing_primary_key || defined_primary_key) &&
|
449
|
-
|
449
|
+
existing_primary_key_columns != defined_primary_key&.columns
|
450
450
|
::DeclareSchema::SchemaChange::PrimaryKeyChange.new(new_table_name, existing_primary_key_columns, defined_primary_key&.columns)
|
451
451
|
end
|
452
452
|
end
|
@@ -509,12 +509,14 @@ module Generators
|
|
509
509
|
|
510
510
|
def foreign_key_changes_due_to_column_renames(fks_to_drop, fks_to_add, to_rename)
|
511
511
|
fks_to_drop.each_with_object([[], []]) do |fk_to_drop, (renamed_fks_to_drop, renamed_fks_to_add)|
|
512
|
-
|
512
|
+
fk_to_add = fks_to_add.find do |fk_to_add|
|
513
513
|
fk_to_add.foreign_key.nil? and raise "Foreign key is not allowed to be nil for #{fk_to_add.inspect}"
|
514
514
|
fk_to_add.child_table_name == fk_to_drop.child_table_name &&
|
515
|
-
|
516
|
-
|
517
|
-
end
|
515
|
+
fk_to_add.parent_table_name == fk_to_drop.parent_table_name &&
|
516
|
+
fk_to_add.foreign_key == to_rename[fk_to_drop.foreign_key]
|
517
|
+
end
|
518
|
+
|
519
|
+
if fk_to_add
|
518
520
|
renamed_fks_to_drop << fk_to_drop
|
519
521
|
renamed_fks_to_add << fk_to_add
|
520
522
|
end
|
@@ -49,11 +49,10 @@ RSpec.describe DeclareSchema::Model::ForeignKeyDefinition do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'when all options passed' do
|
52
|
-
let(:foreign_key) { nil }
|
53
52
|
let(:options) { { parent_table: :networks, foreign_key: :the_network_id, constraint_name: :constraint_1, dependent: :delete } }
|
54
53
|
|
55
54
|
it 'normalizes symbols to strings' do
|
56
|
-
expect(subject.foreign_key).to
|
55
|
+
expect(subject.foreign_key).to eq('network_id')
|
57
56
|
expect(subject.foreign_key_name).to eq('the_network_id')
|
58
57
|
expect(subject.parent_table_name).to eq('networks')
|
59
58
|
expect(subject.constraint_name).to eq('constraint_1')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: declare_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.3.pre.ga.
|
4
|
+
version: 1.2.3.pre.ga.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca Development adapted from hobo_fields by Tom Locke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|