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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3779bc8749c7a1bbfff8cffe381af079bdeaa0caaa6b7f9058990c0089a9052b
4
- data.tar.gz: a71190beaa092b5167020190ffc76405712116d8c0f9cab99c286cdf2e49824f
3
+ metadata.gz: 58a248172bd53075285dcb1fa69f4c8e3bcfa8ab382445e78823d1a284695c3d
4
+ data.tar.gz: f7568382f78041f9279ff389e1b4f17f389f6ebfef37bde0c9b557ea2f0efeed
5
5
  SHA512:
6
- metadata.gz: 2e61dd23b379debefeeaafdfbc9b7f9381a3b8e8cf3fc07c893038b1231a4f401dd440f35bd19802d0829a643b0f40d5363b2f3e934cafadfa2aa9766cd7cdcd
7
- data.tar.gz: 5ca8c6ced24e4d9276da3cef89278497e177b11af4c3a5b468401d7773dd8559c6de2f6178178f9db5110c17b3dd40b30610459dae19de6dfb9113ad63c92f79
6
+ metadata.gz: 331e86965d4537a88a18d56fc593bf7359a8cee7d4ea69e1e401d53cf2c704b86dae70db004b29738025b2851b528d4a03cc8cea0270b56ffe96cbb41df4d3a9
7
+ data.tar.gz: 1704cb3599ee8de9695efa8a4af09134f876192ff902ec111a705bdb0ab6f56a8af7bf2e59148fee9037866dab605e622b99c11137330f66decf4df316728e00
data/CHANGELOG.md CHANGED
@@ -1,11 +1,14 @@
1
1
  # Changelog
2
2
 
3
- ## 3.0
3
+ ## 3.2
4
4
 
5
- ### 3.2.0.beta (2026/03/22)
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ridgepole
4
- VERSION = '3.2.0.beta'
4
+ VERSION = '3.2.0'
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.0.beta
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara