ridgepole 3.2.0 → 3.2.1
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 +7 -2
- data/lib/ridgepole/diff.rb +14 -3
- 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: 44c06587d61c4599e0f7f0b10cdcc16829bd43122c9545a9e7441e22e5d1a5be
|
|
4
|
+
data.tar.gz: 350526f0a2303c72901e214c9c01996062a3758581815605152ef702ffefcc16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0634c00dfc3a1c34f44e22d76cef892d17b5115a344ed600f5152ebba12e776668e8aa987650ee680cf8263a1cf779f39963a1b5cf2c7cbd20393d8a31c29b40
|
|
7
|
+
data.tar.gz: e5303a3b7c53068957d7b27613cb2b608043d1cd6a7adf9ee278378d7e6227794909f32d01289f484e00c5b480613c6dd6ce18066b6cf634b6849d69e9a304b0
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## 3.2
|
|
4
4
|
|
|
5
|
+
### 3.2.1 (2026/05/04)
|
|
6
|
+
|
|
7
|
+
- Warn when an anonymous index ambiguously matches multiple DB indexes. [pull#692](https://github.com/ridgepole/ridgepole/pull/692)
|
|
8
|
+
|
|
5
9
|
### 3.2.0 (2026/03/28)
|
|
6
10
|
|
|
7
11
|
- Fix spurious diff for `timestamp`/`datetime` with `precision: 6` on MySQL. [pull#665](https://github.com/ridgepole/ridgepole/pull/665)
|
data/README.md
CHANGED
|
@@ -9,6 +9,11 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
|
9
9
|
[](https://github.com/ridgepole/ridgepole/actions/workflows/test.yml)
|
|
10
10
|
[](https://codecov.io/gh/ridgepole/ridgepole)
|
|
11
11
|
|
|
12
|
+
> [!TIP]
|
|
13
|
+
> Currently developing a similar tool for PostgreSQL.
|
|
14
|
+
>
|
|
15
|
+
> see https://github.com/winebarrel/pistachio
|
|
16
|
+
|
|
12
17
|
> [!warning]
|
|
13
18
|
> The order of columns when exporting has changed in Rails 8.1. https://github.com/rails/rails/pull/53281
|
|
14
19
|
>
|
|
@@ -315,11 +320,11 @@ EOS
|
|
|
315
320
|
|
|
316
321
|
execute("CREATE OR REPLACE VIEW `active_users` AS #{view_select}") do |c|
|
|
317
322
|
definition = c.raw_connection.query(<<-SQL).first&.first
|
|
318
|
-
SELECT
|
|
323
|
+
SELECT VIEW_DEFINITION FROM information_schema.views
|
|
319
324
|
WHERE TABLE_SCHEMA = 'mydb'
|
|
320
325
|
AND TABLE_NAME = 'active_users';
|
|
321
326
|
SQL
|
|
322
|
-
definition != view_select
|
|
327
|
+
definition&.strip != view_select
|
|
323
328
|
end
|
|
324
329
|
```
|
|
325
330
|
|
data/lib/ridgepole/diff.rb
CHANGED
|
@@ -104,7 +104,7 @@ module Ridgepole
|
|
|
104
104
|
scan_options_change(table_name, from[:options], to[:options], table_delta)
|
|
105
105
|
scan_definition_change(from[:definition], to[:definition], from[:indices], table_name, from[:options], table_delta)
|
|
106
106
|
apply_column_renames_to_indices(from[:indices], table_delta.dig(:definition, :rename))
|
|
107
|
-
scan_indices_change(from[:indices], to[:indices], to[:definition], table_delta, from[:options], to[:options])
|
|
107
|
+
scan_indices_change(table_name, from[:indices], to[:indices], to[:definition], table_delta, from[:options], to[:options])
|
|
108
108
|
scan_foreign_keys_change(from[:foreign_keys], to[:foreign_keys], table_delta, @options)
|
|
109
109
|
scan_check_constraints_change(from[:check_constraints], to[:check_constraints], table_delta)
|
|
110
110
|
scan_exclusion_constraints_change(from[:exclusion_constraints], to[:exclusion_constraints], table_delta)
|
|
@@ -356,7 +356,7 @@ module Ridgepole
|
|
|
356
356
|
end
|
|
357
357
|
end
|
|
358
358
|
|
|
359
|
-
def scan_indices_change(from, to, to_columns, table_delta, _from_table_options, to_table_options)
|
|
359
|
+
def scan_indices_change(table_name, from, to, to_columns, table_delta, _from_table_options, to_table_options)
|
|
360
360
|
from = (from || {}).dup
|
|
361
361
|
to = (to || {}).dup
|
|
362
362
|
indices_delta = {}
|
|
@@ -365,7 +365,18 @@ module Ridgepole
|
|
|
365
365
|
ignore_index = to_attrs.fetch(:options, {}).delete(:ignore)
|
|
366
366
|
|
|
367
367
|
if index_name.is_a?(Array)
|
|
368
|
-
|
|
368
|
+
matching = from.select { |_name, attrs| attrs[:column_name] == index_name }
|
|
369
|
+
|
|
370
|
+
if matching.size > 1 && !ignore_index
|
|
371
|
+
@logger.warn(
|
|
372
|
+
"[WARNING] Multiple existing indexes on `#{table_name}` match column #{index_name.inspect}: " \
|
|
373
|
+
"#{matching.keys.map(&:inspect).join(', ')}. " \
|
|
374
|
+
'The choice of which index to keep depends on iteration order; ' \
|
|
375
|
+
'specify `name:` explicitly to disambiguate.'
|
|
376
|
+
)
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
from_index_name, from_attrs = matching.first
|
|
369
380
|
|
|
370
381
|
if from_attrs
|
|
371
382
|
from.delete(from_index_name)
|
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.1
|
|
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.86.1
|
|
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.86.1
|
|
256
256
|
- !ruby/object:Gem::Dependency
|
|
257
257
|
name: rubocop-rake
|
|
258
258
|
requirement: !ruby/object:Gem::Requirement
|