ridgepole 3.2.1 → 3.2.2
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 +4 -0
- data/README.md +4 -3
- data/lib/ridgepole/delta.rb +28 -28
- data/lib/ridgepole/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa8b60187f54d3f6f510aae6326606c4d0885c3867cc48c6b51d27fd5ac1c5e1
|
|
4
|
+
data.tar.gz: 5c52635dff367490eeb5ebda435ea26e4c90f784ef4036c21fb6d58865b93674
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54c4b813601a1bc68891456a7d95ab41641dc63270ca22b0652f06d6757d49b6740a6c0738cc3f5f28c69c5d80c22bd2ecb0b7e7d7de12e6c321f591b95db6cd
|
|
7
|
+
data.tar.gz: df2418e5c2bb8ebfe5759c04d3656e524f3b94e995ba24c67f6e74629bdce00667c324d0265433a7333b335ab9245b133c5212a5f0dc282a57692bb6c83b41cf
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## 3.2
|
|
4
4
|
|
|
5
|
+
### 3.2.2 (2026/06/14)
|
|
6
|
+
|
|
7
|
+
- Fix constraint removal order when dropping columns. [pull#705](https://github.com/ridgepole/ridgepole/pull/705)
|
|
8
|
+
|
|
5
9
|
### 3.2.1 (2026/05/04)
|
|
6
10
|
|
|
7
11
|
- Warn when an anonymous index ambiguously matches multiple DB indexes. [pull#692](https://github.com/ridgepole/ridgepole/pull/692)
|
data/README.md
CHANGED
|
@@ -10,9 +10,10 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
|
10
10
|
[](https://codecov.io/gh/ridgepole/ridgepole)
|
|
11
11
|
|
|
12
12
|
> [!TIP]
|
|
13
|
-
>
|
|
14
|
-
>
|
|
15
|
-
>
|
|
13
|
+
> Also developing similar declarative schema tools — single Go binary, plain SQL as the schema definition:
|
|
14
|
+
>
|
|
15
|
+
> * [pistachio](https://github.com/winebarrel/pistachio): for PostgreSQL
|
|
16
|
+
> * [myschema](https://github.com/winebarrel/myschema): for MySQL
|
|
16
17
|
|
|
17
18
|
> [!warning]
|
|
18
19
|
> The order of columns when exporting has changed in Rails 8.1. https://github.com/rails/rails/pull/53281
|
data/lib/ridgepole/delta.rb
CHANGED
|
@@ -31,11 +31,11 @@ module Ridgepole
|
|
|
31
31
|
|
|
32
32
|
def script
|
|
33
33
|
buf = StringIO.new
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
pre_buf = StringIO.new
|
|
35
|
+
post_buf = StringIO.new
|
|
36
36
|
|
|
37
37
|
(@delta[:add] || {}).each do |table_name, attrs|
|
|
38
|
-
append_create_table(table_name, attrs, buf,
|
|
38
|
+
append_create_table(table_name, attrs, buf, post_buf)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
(@delta[:rename] || {}).each do |table_name, attrs|
|
|
@@ -43,7 +43,7 @@ module Ridgepole
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
(@delta[:change] || {}).each do |table_name, attrs|
|
|
46
|
-
append_change(table_name, attrs, buf,
|
|
46
|
+
append_change(table_name, attrs, buf, pre_buf, post_buf)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
(@delta[:delete] || {}).each do |table_name, attrs|
|
|
@@ -51,9 +51,9 @@ module Ridgepole
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
[
|
|
54
|
-
|
|
54
|
+
pre_buf,
|
|
55
55
|
buf,
|
|
56
|
-
|
|
56
|
+
post_buf
|
|
57
57
|
].map { |b| b.string.strip }.join("\n\n").strip
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -221,7 +221,7 @@ module Ridgepole
|
|
|
221
221
|
end
|
|
222
222
|
end
|
|
223
223
|
|
|
224
|
-
def append_create_table(table_name, attrs, buf,
|
|
224
|
+
def append_create_table(table_name, attrs, buf, post_buf)
|
|
225
225
|
options = attrs[:options] || {}
|
|
226
226
|
definition = attrs[:definition] || {}
|
|
227
227
|
indices = attrs[:indices] || {}
|
|
@@ -289,12 +289,12 @@ end
|
|
|
289
289
|
|
|
290
290
|
unless (foreign_keys = attrs[:foreign_keys] || {}).empty?
|
|
291
291
|
foreign_keys.each_value do |foreign_key_attrs|
|
|
292
|
-
append_add_foreign_key(table_name, foreign_key_attrs,
|
|
292
|
+
append_add_foreign_key(table_name, foreign_key_attrs, post_buf, @options)
|
|
293
293
|
end
|
|
294
294
|
end
|
|
295
295
|
|
|
296
296
|
buf.puts
|
|
297
|
-
|
|
297
|
+
post_buf.puts
|
|
298
298
|
end
|
|
299
299
|
|
|
300
300
|
def partition_indices_for_create(definition, indices)
|
|
@@ -370,7 +370,7 @@ change_table_comment(#{table_name.inspect}, #{table_comment.inspect})
|
|
|
370
370
|
end
|
|
371
371
|
end
|
|
372
372
|
|
|
373
|
-
def append_change(table_name, attrs, buf,
|
|
373
|
+
def append_change(table_name, attrs, buf, pre_buf, post_buf)
|
|
374
374
|
definition = attrs[:definition] || {}
|
|
375
375
|
primary_key_definition = attrs[:primary_key_definition] || {}
|
|
376
376
|
indices = attrs[:indices] || {}
|
|
@@ -393,10 +393,10 @@ change_table_comment(#{table_name.inspect}, #{table_comment.inspect})
|
|
|
393
393
|
end
|
|
394
394
|
end
|
|
395
395
|
|
|
396
|
-
append_change_foreign_keys(table_name, foreign_keys,
|
|
397
|
-
append_change_check_constraints(table_name, check_constraints,
|
|
398
|
-
append_change_exclusion_constraints(table_name, exclusion_constraints,
|
|
399
|
-
append_change_unique_constraints(table_name, unique_constraints,
|
|
396
|
+
append_change_foreign_keys(table_name, foreign_keys, pre_buf, post_buf, @options) unless foreign_keys.empty?
|
|
397
|
+
append_change_check_constraints(table_name, check_constraints, pre_buf, post_buf) unless check_constraints.empty?
|
|
398
|
+
append_change_exclusion_constraints(table_name, exclusion_constraints, pre_buf, post_buf) unless exclusion_constraints.empty?
|
|
399
|
+
append_change_unique_constraints(table_name, unique_constraints, pre_buf, post_buf) unless unique_constraints.empty?
|
|
400
400
|
|
|
401
401
|
if table_options || table_charset || table_collation
|
|
402
402
|
append_change_table_raw_options(table_name, table_options, table_charset, table_collation,
|
|
@@ -407,8 +407,8 @@ change_table_comment(#{table_name.inspect}, #{table_comment.inspect})
|
|
|
407
407
|
append_change_column_comments(table_name, column_comments, buf) unless column_comments.empty?
|
|
408
408
|
|
|
409
409
|
buf.puts
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
pre_buf.puts
|
|
411
|
+
post_buf.puts
|
|
412
412
|
end
|
|
413
413
|
|
|
414
414
|
def append_change_column_comments(table_name, column_comments, buf)
|
|
@@ -560,13 +560,13 @@ remove_index(#{table_name.inspect}, #{target})
|
|
|
560
560
|
end
|
|
561
561
|
end
|
|
562
562
|
|
|
563
|
-
def append_change_foreign_keys(table_name, delta,
|
|
563
|
+
def append_change_foreign_keys(table_name, delta, pre_buf, post_buf, options)
|
|
564
564
|
(delta[:delete] || {}).each_value do |attrs|
|
|
565
|
-
append_remove_foreign_key(table_name, attrs,
|
|
565
|
+
append_remove_foreign_key(table_name, attrs, pre_buf, options)
|
|
566
566
|
end
|
|
567
567
|
|
|
568
568
|
(delta[:add] || {}).each_value do |attrs|
|
|
569
|
-
append_add_foreign_key(table_name, attrs,
|
|
569
|
+
append_add_foreign_key(table_name, attrs, post_buf, options)
|
|
570
570
|
end
|
|
571
571
|
end
|
|
572
572
|
|
|
@@ -594,13 +594,13 @@ remove_foreign_key(#{table_name.inspect}, #{target})
|
|
|
594
594
|
RUBY
|
|
595
595
|
end
|
|
596
596
|
|
|
597
|
-
def append_change_check_constraints(table_name, delta,
|
|
597
|
+
def append_change_check_constraints(table_name, delta, pre_buf, post_buf)
|
|
598
598
|
(delta[:delete] || {}).each_value do |attrs|
|
|
599
|
-
append_remove_check_constraint(table_name, attrs,
|
|
599
|
+
append_remove_check_constraint(table_name, attrs, pre_buf)
|
|
600
600
|
end
|
|
601
601
|
|
|
602
602
|
(delta[:add] || {}).each_value do |attrs|
|
|
603
|
-
append_add_check_constraint(table_name, attrs,
|
|
603
|
+
append_add_check_constraint(table_name, attrs, post_buf)
|
|
604
604
|
end
|
|
605
605
|
end
|
|
606
606
|
|
|
@@ -628,13 +628,13 @@ remove_check_constraint(#{table_name.inspect}, #{expression.inspect}, **#{attrs_
|
|
|
628
628
|
RUBY
|
|
629
629
|
end
|
|
630
630
|
|
|
631
|
-
def append_change_exclusion_constraints(table_name, delta,
|
|
631
|
+
def append_change_exclusion_constraints(table_name, delta, pre_buf, post_buf)
|
|
632
632
|
(delta[:delete] || {}).each_value do |attrs|
|
|
633
|
-
append_remove_exclusion_constraint(table_name, attrs,
|
|
633
|
+
append_remove_exclusion_constraint(table_name, attrs, pre_buf)
|
|
634
634
|
end
|
|
635
635
|
|
|
636
636
|
(delta[:add] || {}).each_value do |attrs|
|
|
637
|
-
append_add_exclusion_constraint(table_name, attrs,
|
|
637
|
+
append_add_exclusion_constraint(table_name, attrs, post_buf)
|
|
638
638
|
end
|
|
639
639
|
end
|
|
640
640
|
|
|
@@ -662,13 +662,13 @@ remove_exclusion_constraint(#{table_name.inspect}, #{expression.inspect}, **#{at
|
|
|
662
662
|
RUBY
|
|
663
663
|
end
|
|
664
664
|
|
|
665
|
-
def append_change_unique_constraints(table_name, delta,
|
|
665
|
+
def append_change_unique_constraints(table_name, delta, pre_buf, post_buf)
|
|
666
666
|
(delta[:delete] || {}).each_value do |attrs|
|
|
667
|
-
append_remove_unique_constraint(table_name, attrs,
|
|
667
|
+
append_remove_unique_constraint(table_name, attrs, pre_buf)
|
|
668
668
|
end
|
|
669
669
|
|
|
670
670
|
(delta[:add] || {}).each_value do |attrs|
|
|
671
|
-
append_add_unique_constraint(table_name, attrs,
|
|
671
|
+
append_add_unique_constraint(table_name, attrs, post_buf)
|
|
672
672
|
end
|
|
673
673
|
end
|
|
674
674
|
|
data/lib/ridgepole/version.rb
CHANGED
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.
|
|
4
|
+
version: 3.2.2
|
|
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.
|
|
248
|
+
version: 1.87.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.
|
|
255
|
+
version: 1.87.0
|
|
256
256
|
- !ruby/object:Gem::Dependency
|
|
257
257
|
name: rubocop-rake
|
|
258
258
|
requirement: !ruby/object:Gem::Requirement
|