declare_schema 1.2.3.pre.ga.10 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Gemfile.lock +1 -1
- data/lib/declare_schema/model/foreign_key_definition.rb +1 -1
- data/lib/declare_schema/model/index_definition.rb +2 -2
- data/lib/declare_schema/version.rb +1 -1
- data/lib/generators/declare_schema/migration/migrator.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 669711ed418b80efe0de5f500d4aaf4bbe2c05e156f699d371949c03d623f681
|
4
|
+
data.tar.gz: eccfcbf169e9bc8fcb7fe704fac82a7fed44b56fba5b676dfefaeb4c37b8f47b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7531ce0c2af9f5fd4c6b73299575cd4676e4cb56e2f6fbb5881af9a6af7aa4671cf63bda306fc21edf7bd4a4eb47806c46e0daa2a514061f1e86cadcedc1e67f
|
7
|
+
data.tar.gz: 41477b8de840d038c4abe7816f2b8f9f26322ec95b9cd6c50e97ebca256280098aa97fa9b3df889aba0ba1629b0feafdf427432f885904b29e796bd2e28dfe39
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [1.2.3] -
|
7
|
+
## [1.2.3] - 2023-04-04
|
8
8
|
### Changed
|
9
9
|
- Fixed a bug where renaming a foreign key resulted in an incorrect migration
|
10
10
|
|
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
|
4
|
+
version: 1.2.3
|
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-
|
11
|
+
date: 2023-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|