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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86fb8e0f1179f4a912b7c841221b20725037a067ba2832f5e6fead997760e131
|
4
|
+
data.tar.gz: 4317f36bbb51f2ff265ba8746d45287e00b0d2b2846b53aee1635d7a658cb4e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 654a545b37437f371acc2a1c8faafcdb6a0282f2edc93357dd5ab73df0f1a55b8f529741ee6a0f68517fc41e90990b5bc15bc4d72c4703158e0e38288b2de868
|
7
|
+
data.tar.gz: 5eeb08441fa3be8f1963b810c07332db31791cde928575d86d827d4cce39801e53903a4cd941c0b9de9e81cd6adfa53cf79b07fd6d09afa2c4b420473907c2d5
|
data/Gemfile.lock
CHANGED
@@ -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
|
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|
|
@@ -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.
|
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
|
11
|
+
date: 2023-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|