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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/strong_migrations/checker.rb +10 -3
- data/lib/strong_migrations/migrator.rb +5 -1
- data/lib/strong_migrations/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: 9fa65b489492df55a19b402db34b26e6a8e4369ad0bd1078622e130d07813a85
|
4
|
+
data.tar.gz: 5ce0a9af74812f962a277ac87fefed4322448b3da5bf7bfbe778e83b5bbd1c88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec4fce43c3f0dd2a8c8e0f74c7aa09d0a4fadf05132285ad91496266476faef87323076fab6067499d9688100b81a78f274e7769af730bc9502f706e6ea5ebb
|
7
|
+
data.tar.gz: 9cebe149959161a5bf1abd62ff69e553187f867da3f49837c95f4843077e9880654eafe41786ff913e1fdba02cc2dd4c8eaf7d35996ce190779d62003a8314fc
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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
|