strong_migrations 2.5.0 → 2.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 971d5d1eabb91dc04c72cc99a24f8b92f1b0d31d8d28369577f48c283b8d8624
4
- data.tar.gz: '08a413578f564ada7f9768aeaf469719ca051e4c37057be6324e593c73fb3144'
3
+ metadata.gz: 9fa65b489492df55a19b402db34b26e6a8e4369ad0bd1078622e130d07813a85
4
+ data.tar.gz: 5ce0a9af74812f962a277ac87fefed4322448b3da5bf7bfbe778e83b5bbd1c88
5
5
  SHA512:
6
- metadata.gz: b8ca27268e166609ec8253ce686c6fe9cbe6d7c4b298f8c80ce7f1690e76a2c997fad2806cce52c9765f6ee92e7e389fdf6c830d3ca8ebb0241574adc02c4b57
7
- data.tar.gz: 18731d2b1bdd12698d6b860a470249a24ea12aaa0b5b74b6510d41527ef2126c46b27ef4aa7c7adb1437bd7a006d0bb7c46490d24ec15720009723e5b0d8eca4
6
+ metadata.gz: bec4fce43c3f0dd2a8c8e0f74c7aa09d0a4fadf05132285ad91496266476faef87323076fab6067499d9688100b81a78f274e7769af730bc9502f706e6ea5ebb
7
+ data.tar.gz: 9cebe149959161a5bf1abd62ff69e553187f867da3f49837c95f4843077e9880654eafe41786ff913e1fdba02cc2dd4c8eaf7d35996ce190779d62003a8314fc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.5.1 (2025-10-13)
2
+
3
+ - Fixed `transaction_timeout` option with DDL transaction
4
+
1
5
  ## 2.5.0 (2025-07-27)
2
6
 
3
7
  - Added check for `rename_schema`
@@ -151,6 +151,16 @@ module StrongMigrations
151
151
  StrongMigrations.skipped_databases.map(&:to_s).include?(db_config_name)
152
152
  end
153
153
 
154
+ def set_transaction_timeout
155
+ return if defined?(@transaction_timeout_set)
156
+
157
+ if StrongMigrations.transaction_timeout
158
+ adapter.set_transaction_timeout(StrongMigrations.transaction_timeout)
159
+ end
160
+
161
+ @transaction_timeout_set = true
162
+ end
163
+
154
164
  private
155
165
 
156
166
  def check_adapter
@@ -183,9 +193,6 @@ module StrongMigrations
183
193
  if StrongMigrations.statement_timeout
184
194
  adapter.set_statement_timeout(StrongMigrations.statement_timeout)
185
195
  end
186
- if StrongMigrations.transaction_timeout
187
- adapter.set_transaction_timeout(StrongMigrations.transaction_timeout)
188
- end
189
196
  if StrongMigrations.lock_timeout
190
197
  adapter.set_lock_timeout(StrongMigrations.lock_timeout)
191
198
  end
@@ -1,7 +1,8 @@
1
1
  module StrongMigrations
2
2
  module Migrator
3
3
  def ddl_transaction(migration, ...)
4
- return super unless StrongMigrations.lock_timeout_retries > 0 && use_transaction?(migration)
4
+ retries = StrongMigrations.lock_timeout_retries > 0 && use_transaction?(migration)
5
+ return super unless retries || StrongMigrations.transaction_timeout
5
6
 
6
7
  # handle MigrationProxy class
7
8
  migration = migration.send(:migration) if !migration.is_a?(ActiveRecord::Migration) && migration.respond_to?(:migration, true)
@@ -9,6 +10,9 @@ module StrongMigrations
9
10
  checker = migration.send(:strong_migrations_checker)
10
11
  return super if checker.skip?
11
12
 
13
+ checker.set_transaction_timeout
14
+ return super unless retries
15
+
12
16
  # retry migration since the entire transaction needs to be rerun
13
17
  checker.retry_lock_timeouts(check_committed: true) do
14
18
  # failed transaction reverts timeout, so need to re-apply
@@ -1,3 +1,3 @@
1
1
  module StrongMigrations
2
- VERSION = "2.5.0"
2
+ VERSION = "2.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strong_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane