declare_schema 1.2.3.pre.ga.10 → 1.2.3.pre.ga.11

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: 5432e4443335e0e9b60e9242f1b6523b833ae70434c7a0a13c5c01fd72b5a96c
4
- data.tar.gz: 94c14df3be1af4d13103417ccec13a41461ecd9ad21922a44338de33b879cda9
3
+ metadata.gz: 86fb8e0f1179f4a912b7c841221b20725037a067ba2832f5e6fead997760e131
4
+ data.tar.gz: 4317f36bbb51f2ff265ba8746d45287e00b0d2b2846b53aee1635d7a658cb4e4
5
5
  SHA512:
6
- metadata.gz: bc84382b23765a035f81b063c6e066f5ef6d56b4605696d3e4a15417d64ba7b42d8c0ddc157796d180b3adde9135934ceee2d156d5de1fecd22f751ee4b303a6
7
- data.tar.gz: afaf8a450c895880c97accb55dbb36c96152b1f3ce7c4ede51e8da5c4aa0044a6862adc2ffcab4f82276285f8a3b19d3226342ac3011d9f6c84bc2a930ac909d
6
+ metadata.gz: 654a545b37437f371acc2a1c8faafcdb6a0282f2edc93357dd5ab73df0f1a55b8f529741ee6a0f68517fc41e90990b5bc15bc4d72c4703158e0e38288b2de868
7
+ data.tar.gz: 5eeb08441fa3be8f1963b810c07332db31791cde928575d86d827d4cce39801e53903a4cd941c0b9de9e81cd6adfa53cf79b07fd6d09afa2c4b420473907c2d5
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.10)
4
+ declare_schema (1.2.3.pre.ga.11)
5
5
  rails (>= 5.0)
6
6
 
7
7
  GEM
@@ -12,7 +12,7 @@ module DeclareSchema
12
12
 
13
13
  def initialize(model, foreign_key, **options)
14
14
  @model = model
15
- @foreign_key = foreign_key.to_s.presence or raise ArgumentError "Foreign key cannot be empty: #{foreign_key.inspect}"
15
+ @foreign_key = foreign_key.to_s.presence or raise ArgumentError "Foreign key must not be empty: #{foreign_key.inspect}"
16
16
  @options = options
17
17
 
18
18
  @child_table_name = model.table_name # unless a table rename, which would happen when a class is renamed??
@@ -33,12 +33,12 @@ module DeclareSchema
33
33
 
34
34
  class << self
35
35
  # extract IndexSpecs from an existing table
36
+ # includes the PRIMARY KEY index
36
37
  def for_model(model, old_table_name = nil)
37
38
  t = old_table_name || model.table_name
38
39
 
39
40
  primary_key_columns = Array(model.connection.primary_key(t)).presence
40
- primary_key_columns or
41
- raise "could not find primary key for table #{t} in #{model.connection.columns(t).inspect}"
41
+ primary_key_columns or raise "could not find primary key for table #{t} in #{model.connection.columns(t).inspect}"
42
42
 
43
43
  primary_key_found = false
44
44
  index_definitions = model.connection.indexes(t).map do |i|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeclareSchema
4
- VERSION = "1.2.3.pre.ga.10"
4
+ VERSION = "1.2.3.pre.ga.11"
5
5
  end
@@ -510,7 +510,6 @@ module Generators
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
- fk_to_add.foreign_key.nil? and raise "Foreign key is not allowed to be nil for #{fk_to_add.inspect}"
514
513
  fk_to_add.child_table_name == fk_to_drop.child_table_name &&
515
514
  fk_to_add.parent_table_name == fk_to_drop.parent_table_name &&
516
515
  fk_to_add.foreign_key == to_rename[fk_to_drop.foreign_key]
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.10
4
+ version: 1.2.3.pre.ga.11
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-31 00:00:00.000000000 Z
11
+ date: 2023-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails