ridgepole 3.2.0.beta → 3.2.0
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 +7 -2
- data/README.md +40 -0
- data/lib/ridgepole/diff.rb +9 -0
- data/lib/ridgepole/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 58a248172bd53075285dcb1fa69f4c8e3bcfa8ab382445e78823d1a284695c3d
|
|
4
|
+
data.tar.gz: f7568382f78041f9279ff389e1b4f17f389f6ebfef37bde0c9b557ea2f0efeed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 331e86965d4537a88a18d56fc593bf7359a8cee7d4ea69e1e401d53cf2c704b86dae70db004b29738025b2851b528d4a03cc8cea0270b56ffe96cbb41df4d3a9
|
|
7
|
+
data.tar.gz: 1704cb3599ee8de9695efa8a4af09134f876192ff902ec111a705bdb0ab6f56a8af7bf2e59148fee9037866dab605e622b99c11137330f66decf4df316728e00
|
data/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 3.
|
|
3
|
+
## 3.2
|
|
4
4
|
|
|
5
|
-
### 3.2.0
|
|
5
|
+
### 3.2.0 (2026/03/28)
|
|
6
6
|
|
|
7
|
+
- Fix spurious diff for `timestamp`/`datetime` with `precision: 6` on MySQL. [pull#665](https://github.com/ridgepole/ridgepole/pull/665)
|
|
7
8
|
- Use `udiff` instead of `diffy`. [pull#657](https://github.com/ridgepole/ridgepole/pull/657)
|
|
8
9
|
|
|
10
|
+
## 3.1
|
|
11
|
+
|
|
9
12
|
### 3.1.5 (2026/03/21)
|
|
10
13
|
|
|
11
14
|
- Fix for renaming references column. [pull#652](https://github.com/ridgepole/ridgepole/pull/652)
|
|
@@ -33,6 +36,8 @@
|
|
|
33
36
|
- Support Rails 8.1 [pull#589](https://github.com/ridgepole/ridgepole/pull/589)
|
|
34
37
|
- Support for migrating PostgreSQL table comments [pull#587](https://github.com/ridgepole/ridgepole/pull/587)
|
|
35
38
|
|
|
39
|
+
## 3.0
|
|
40
|
+
|
|
36
41
|
### 3.0.4 (2025/08/31)
|
|
37
42
|
|
|
38
43
|
- Fix checking foreign key without index [pull#571](https://github.com/ridgepole/ridgepole/pull/571)
|
data/README.md
CHANGED
|
@@ -303,6 +303,46 @@ execute("ALTER TABLE books ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFE
|
|
|
303
303
|
end
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
+
### Manage View using `execute`
|
|
307
|
+
|
|
308
|
+
#### MySQL
|
|
309
|
+
|
|
310
|
+
```ruby
|
|
311
|
+
# NOTE: view_select must match the normalized form stored in information_schema.views.VIEW_DEFINITION
|
|
312
|
+
view_select = <<-EOS.strip
|
|
313
|
+
select `mydb`.`users`.`id` AS `id`,`mydb`.`users`.`name` AS `name`,`mydb`.`users`.`active` AS `active` from `mydb`.`users` where (`mydb`.`users`.`active` = 1)
|
|
314
|
+
EOS
|
|
315
|
+
|
|
316
|
+
execute("CREATE OR REPLACE VIEW `active_users` AS #{view_select}") do |c|
|
|
317
|
+
definition = c.raw_connection.query(<<-SQL).first&.first
|
|
318
|
+
SELECT SHA(VIEW_DEFINITION) FROM information_schema.views
|
|
319
|
+
WHERE TABLE_SCHEMA = 'mydb'
|
|
320
|
+
AND TABLE_NAME = 'active_users';
|
|
321
|
+
SQL
|
|
322
|
+
definition != view_select
|
|
323
|
+
end
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### PostgreSQL
|
|
327
|
+
|
|
328
|
+
```ruby
|
|
329
|
+
# NOTE: view_select must match the normalized form stored in pg_views.definition
|
|
330
|
+
view_select = <<~EOS.strip
|
|
331
|
+
SELECT users.name
|
|
332
|
+
FROM users
|
|
333
|
+
WHERE (users.active = false);
|
|
334
|
+
EOS
|
|
335
|
+
|
|
336
|
+
execute("CREATE OR REPLACE VIEW active_users AS #{view_select}") do |c|
|
|
337
|
+
definition = c.raw_connection.query(<<-SQL).first&.dig("definition")
|
|
338
|
+
SELECT definition FROM pg_views
|
|
339
|
+
WHERE schemaname = 'public'
|
|
340
|
+
AND viewname = 'active_users';
|
|
341
|
+
SQL
|
|
342
|
+
definition&.strip != view_select
|
|
343
|
+
end
|
|
344
|
+
```
|
|
345
|
+
|
|
306
346
|
## Diff
|
|
307
347
|
```sh
|
|
308
348
|
$ ridgepole --diff file1.schema file2.schema
|
data/lib/ridgepole/diff.rb
CHANGED
|
@@ -445,6 +445,15 @@ module Ridgepole
|
|
|
445
445
|
end
|
|
446
446
|
end
|
|
447
447
|
|
|
448
|
+
# Since ActiveRecord >= 7.0.5, datetime/timestamp columns default to precision: 6 on MySQL.
|
|
449
|
+
# Strip precision: 6 when it matches the default to avoid spurious diffs.
|
|
450
|
+
# cf. https://github.com/ridgepole/ridgepole/issues/515
|
|
451
|
+
if %i[datetime timestamp].include?(attrs[:type]) &&
|
|
452
|
+
opts[:precision] == 6 &&
|
|
453
|
+
ActiveRecord.gem_version >= Gem::Version.new('7.0.5')
|
|
454
|
+
opts.delete(:precision)
|
|
455
|
+
end
|
|
456
|
+
|
|
448
457
|
if opts[:size] && %i[text blob binary].include?(attrs[:type])
|
|
449
458
|
case opts.delete(:size)
|
|
450
459
|
when :tiny
|
data/lib/ridgepole/version.rb
CHANGED