ridgepole 3.2.5 → 3.2.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abd4de93bb4a0d0938356df4090e8f4c703f0e8cb17e4b4c886174aed0fc757c
4
- data.tar.gz: d0e95a3692a07834a515a833500918c01fca28dcdf38bda90dc9a4974f1efccf
3
+ metadata.gz: 6c4edcc8d6e366c0b30c4b396f7ade46d28c30633e5bc8a54927615b5f15a2a6
4
+ data.tar.gz: 328bd6c572f05a1c3f34508c321ba00bfdb7eb5a3ee8d6fb682fa8731eb33a00
5
5
  SHA512:
6
- metadata.gz: ef67a2f85f7d9d510384409483a52c9ea7620d8bc85219d14ab26818759e85d603f6aa22c1c8a3a3e40cf1f7f15f9093810bb03c5c1737091d5afe770c7d62a4
7
- data.tar.gz: 7a6320a5a28a23a8fbeed7448b1715c845e7985d8d45a3f7ef9ed7d17c4246b20a2e407790daebbf0795e10462c2e121ad74ce472015c7a9810c30aa19194e11
6
+ metadata.gz: f0c19f962dc96195a80dce46fb622e610dd358e97dbb21bc67613ab4974d62647c63e6e341786b1262d2cec071dfd110febf55016ff3558c6f8ff033d30e33b9
7
+ data.tar.gz: bcd0c4f62afbc2f849cf99679b07ec14f2653994e574e840da5467a5dac1db616d8653b837984b700d50c54b9946cd24f38ea90ab0c39310e4c5bfc82b4d58bf
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## 3.2
4
4
 
5
+ ### 3.2.7 (2026/10/16)
6
+
7
+ - Pass `column:` to `validate_foreign_key` for unnamed foreign keys. [pull#750](https://github.com/ridgepole/ridgepole/pull/750)
8
+
9
+ ### 3.2.6 (2026/10/15)
10
+
11
+ - Pass `column:` to `remove_foreign_key` for unnamed foreign keys. [pull#746](https://github.com/ridgepole/ridgepole/pull/746)
12
+ - Support the batched `table_options` API in Rails 8.2. [pull#740](https://github.com/ridgepole/ridgepole/pull/740)
13
+
5
14
  ### 3.2.5 (2026/08/11)
6
15
 
7
16
  - Fix `--with-apply` validation to require `--config`. [pull#733](https://github.com/ridgepole/ridgepole/pull/733)
data/README.md CHANGED
@@ -8,6 +8,7 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
8
8
  [![Gem Version](https://badge.fury.io/rb/ridgepole.svg)](https://badge.fury.io/rb/ridgepole)
9
9
  [![test](https://github.com/ridgepole/ridgepole/actions/workflows/test.yml/badge.svg)](https://github.com/ridgepole/ridgepole/actions/workflows/test.yml)
10
10
  [![codecov](https://codecov.io/gh/ridgepole/ridgepole/graph/badge.svg)](https://codecov.io/gh/ridgepole/ridgepole)
11
+ [![Greptile: The War on Bugs](https://www.greptile.com/badge.svg)](https://www.greptile.com/?utm_source=oss_badge&utm_medium=readme&utm_campaign=greptile_for_open_source)
11
12
 
12
13
  > [!TIP]
13
14
  > Also developing similar declarative schema tools — single Go binary, plain SQL as the schema definition. Give it a try.
@@ -586,9 +586,12 @@ add_foreign_key(#{table_name.inspect}, #{to_table.inspect}, **#{attrs_options.in
586
586
  def append_remove_foreign_key(table_name, attrs, buf, _options)
587
587
  attrs_options = attrs[:options] || {}
588
588
  fk_name = attrs_options[:name]
589
+ fk_column = attrs_options[:column]
589
590
 
590
591
  target = if fk_name
591
592
  "name: #{fk_name.inspect}"
593
+ elsif fk_column
594
+ "#{attrs.fetch(:to_table).inspect}, column: #{fk_column.inspect}"
592
595
  else
593
596
  attrs.fetch(:to_table).inspect
594
597
  end
@@ -601,9 +604,12 @@ remove_foreign_key(#{table_name.inspect}, #{target})
601
604
  def append_validate_foreign_key(table_name, attrs, buf)
602
605
  attrs_options = attrs[:options] || {}
603
606
  fk_name = attrs_options[:name]
607
+ fk_column = attrs_options[:column]
604
608
 
605
609
  target = if fk_name
606
610
  "name: #{fk_name.inspect}"
611
+ elsif fk_column
612
+ "#{attrs.fetch(:to_table).inspect}, column: #{fk_column.inspect}"
607
613
  else
608
614
  attrs.fetch(:to_table).inspect
609
615
  end
@@ -16,14 +16,28 @@ module Ridgepole
16
16
  def table_options(table_name)
17
17
  options = super
18
18
 
19
- if options && @__without_table_options
20
- options.delete(:options)
21
- options.delete(:charset)
22
- options.delete(:collation)
19
+ if @__without_table_options
20
+ # NOTE: Since Rails 8.2, `table_options` also accepts an array of table names
21
+ # and then returns a hash of options keyed by table name.
22
+ if table_name.is_a?(Array)
23
+ options.each_value { |table_option| delete_table_options!(table_option) }
24
+ else
25
+ delete_table_options!(options)
26
+ end
23
27
  end
24
28
 
25
29
  options
26
30
  end
31
+
32
+ private
33
+
34
+ def delete_table_options!(options)
35
+ return unless options
36
+
37
+ options.delete(:options)
38
+ options.delete(:charset)
39
+ options.delete(:collation)
40
+ end
27
41
  end
28
42
  end
29
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ridgepole
4
- VERSION = '3.2.5'
4
+ VERSION = '3.2.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridgepole
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.5
4
+ version: 3.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
@@ -245,14 +245,14 @@ dependencies:
245
245
  requirements:
246
246
  - - '='
247
247
  - !ruby/object:Gem::Version
248
- version: 1.89.0
248
+ version: 1.91.0
249
249
  type: :development
250
250
  prerelease: false
251
251
  version_requirements: !ruby/object:Gem::Requirement
252
252
  requirements:
253
253
  - - '='
254
254
  - !ruby/object:Gem::Version
255
- version: 1.89.0
255
+ version: 1.91.0
256
256
  - !ruby/object:Gem::Dependency
257
257
  name: rubocop-rake
258
258
  requirement: !ruby/object:Gem::Requirement