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: '0681126cdd17705ec35f41ab9e4dc608fbc961b50614124ace54e17c49675eca'
4
- data.tar.gz: efa69b2eb51fa5e2a9ec5b22ed04ecdf91679abecfb674646ea7e461974a097e
3
+ metadata.gz: 308421d49ba0007340aad10be1ca95b4798d1c3a98c3e7bb52e41d81f903530e
4
+ data.tar.gz: 7e1c75911502f841c935308a8b1f8a8997702839eb348f07b45eee05cc3440b3
5
5
  SHA512:
6
- metadata.gz: 69d913a279f29f6368ceb224791213d9bc711e27c8a4a598f7feeb720bf753c5b6e5d65e7537655979b9bc6da5ee663c69f8c9dc2a8e2156b5b1e1c7608cc03b
7
- data.tar.gz: 5f4b21eb05fc804a883f5bef692bf3473e25b8a61e066cf094e363b46be27fede8fc520efebc04a49ccd4e3c56fa7bddfcb5713204c828dba146904423781535
6
+ metadata.gz: 2e4d907b428190cdb3cfa5b99c27e9a751a110144092e9498888b79a5050596bb849afb73feb38d6f4bba73617f4a3d00e0c8d4cde9634c124472f93a5003022
7
+ data.tar.gz: 1774ac3658dccd0f32f280b04358cfa80707053d8d595b3527f467e97c8b91f66651de3737fea969abd01c2454bc028aca12ae98380e7a1d76d0ef4dc0a37eb5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- declare_schema (1.2.3.pre.ga.6)
4
+ declare_schema (1.2.3.pre.ga.7)
5
5
  rails (>= 5.0)
6
6
 
7
7
  GEM
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeclareSchema
4
- VERSION = "1.2.3.pre.ga.6"
4
+ VERSION = "1.2.3.pre.ga.7"
5
5
  end
@@ -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
- existing_primary_key_columns != defined_primary_key&.columns
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
- if (fk_to_add = fks_to_add.find do |fk_to_add|
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
- 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)
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 be_nil
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.6
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-29 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails