ridgepole 3.2.7 → 3.2.8

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: 6c4edcc8d6e366c0b30c4b396f7ade46d28c30633e5bc8a54927615b5f15a2a6
4
- data.tar.gz: 328bd6c572f05a1c3f34508c321ba00bfdb7eb5a3ee8d6fb682fa8731eb33a00
3
+ metadata.gz: 710e0a6b4939d489088aa89eade29e41879a3d8c2605ad46579d9a68cb78edb6
4
+ data.tar.gz: 2e209f3ee2382ca1271f1130415224a687069a620a91e2e9db24450ebe2ce944
5
5
  SHA512:
6
- metadata.gz: f0c19f962dc96195a80dce46fb622e610dd358e97dbb21bc67613ab4974d62647c63e6e341786b1262d2cec071dfd110febf55016ff3558c6f8ff033d30e33b9
7
- data.tar.gz: bcd0c4f62afbc2f849cf99679b07ec14f2653994e574e840da5467a5dac1db616d8653b837984b700d50c54b9946cd24f38ea90ab0c39310e4c5bfc82b4d58bf
6
+ metadata.gz: 96b25fd1acb23f673c729b7ad31065e6245c8f91d2f885efbdb821cf7ae17b504d666362a067d5cd7ae8366486505876a259d6c43200c5aee281c8883867d5c5
7
+ data.tar.gz: d45c0b3e529b2459309458f604e90c8a3cf97f2b402aa08badd14ec2b88c6b55fef78012f382824747acde4345fe82aa6ca71950f835c00c0fffb1916bed5d98
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## 3.2
4
4
 
5
+ ### 3.2.8 (2026/11/04)
6
+
7
+ - On PostgreSQL, add `validate: false` check constraints after `create_table` so that they stay NOT VALID on new tables. [pull#758](https://github.com/ridgepole/ridgepole/pull/758)
8
+
5
9
  ### 3.2.7 (2026/10/16)
6
10
 
7
11
  - Pass `column:` to `validate_foreign_key` for unnamed foreign keys. [pull#750](https://github.com/ridgepole/ridgepole/pull/750)
@@ -257,10 +257,16 @@ create_table(#{table_name.inspect}, #{inspect_options_include_default_proc(optio
257
257
  append_add_index(table_name, index_name, index_attrs, buf, true)
258
258
  end
259
259
 
260
- unless (check_constraints = attrs[:check_constraints] || {}).empty?
261
- check_constraints.each_value do |check_constraint_attrs|
262
- append_add_check_constraint(table_name, check_constraint_attrs, buf, true)
263
- end
260
+ # PostgreSQL ignores NOT VALID on constraints defined inline in CREATE TABLE and marks them
261
+ # validated, so add 'validate: false' check constraints via ALTER TABLE after CREATE TABLE
262
+ # to keep them NOT VALID as declared in the DSL.
263
+ # cf. https://github.com/rails/rails/pull/53735
264
+ not_valid_check_constraints, check_constraints = (attrs[:check_constraints] || {}).values.partition do |check_constraint_attrs|
265
+ check_constraint_attrs.dig(:options, :validate) == false
266
+ end
267
+
268
+ check_constraints.each do |check_constraint_attrs|
269
+ append_add_check_constraint(table_name, check_constraint_attrs, buf, true)
264
270
  end
265
271
 
266
272
  unless (exclusion_constraints = attrs[:exclusion_constraints] || {}).empty?
@@ -287,6 +293,10 @@ end
287
293
  end
288
294
  end
289
295
 
296
+ not_valid_check_constraints.each do |check_constraint_attrs|
297
+ append_add_check_constraint(table_name, check_constraint_attrs, buf)
298
+ end
299
+
290
300
  unless (foreign_keys = attrs[:foreign_keys] || {}).empty?
291
301
  foreign_keys.each_value do |foreign_key_attrs|
292
302
  append_add_foreign_key(table_name, foreign_key_attrs, post_buf, @options)
@@ -602,7 +602,8 @@ module Ridgepole
602
602
  # 'validate: false' (NOT VALID) is a strategy for ALTER TABLE ADD CONSTRAINT to avoid
603
603
  # ACCESS EXCLUSIVE lock on large tables. NOT VALID state itself is persisted by the DB,
604
604
  # but PostgreSQL ignores NOT VALID for constraints created inline within CREATE TABLE, so
605
- # whether the resulting constraint is NOT VALID depends on how it was created. Restoring
605
+ # whether the resulting constraint is NOT VALID depends on how it was created (tables
606
+ # created before ridgepole added them via ALTER TABLE have them validated). Restoring
606
607
  # NOT VALID via DROP + ADD has no benefit, so ignore the diff when the DB dump lacks
607
608
  # :validate and the DSL specifies validate: false.
608
609
  def ignorable_validate_diff?(from_attrs, to_attrs)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ridgepole
4
- VERSION = '3.2.7'
4
+ VERSION = '3.2.8'
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.7
4
+ version: 3.2.8
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.91.0
248
+ version: 1.92.2
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.91.0
255
+ version: 1.92.2
256
256
  - !ruby/object:Gem::Dependency
257
257
  name: rubocop-rake
258
258
  requirement: !ruby/object:Gem::Requirement