declare_schema 1.2.3.pre.ga.10 → 1.2.3

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: 669711ed418b80efe0de5f500d4aaf4bbe2c05e156f699d371949c03d623f681
4
+ data.tar.gz: eccfcbf169e9bc8fcb7fe704fac82a7fed44b56fba5b676dfefaeb4c37b8f47b
5
5
  SHA512:
6
- metadata.gz: bc84382b23765a035f81b063c6e066f5ef6d56b4605696d3e4a15417d64ba7b42d8c0ddc157796d180b3adde9135934ceee2d156d5de1fecd22f751ee4b303a6
7
- data.tar.gz: afaf8a450c895880c97accb55dbb36c96152b1f3ce7c4ede51e8da5c4aa0044a6862adc2ffcab4f82276285f8a3b19d3226342ac3011d9f6c84bc2a930ac909d
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] - Unreleased
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
@@ -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)
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"
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
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-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails