online_migrations 0.30.0 → 0.31.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 +10 -0
- data/lib/online_migrations/background_data_migrations/migration_job.rb +2 -0
- data/lib/online_migrations/lock_retrier.rb +1 -1
- data/lib/online_migrations/schema_statements.rb +13 -0
- data/lib/online_migrations/utils.rb +8 -1
- data/lib/online_migrations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5e1f97d972736356a7aa992a5fb39d318ebdd9709952c9015f98d832b5e94c1
|
|
4
|
+
data.tar.gz: fd4b0fc1ae446665dd22e27519ffa93272def9ea25d107bfed037b754e9f01e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 170f3d973598ac2bb5b8cdf6acfa28217b58fda566e3482d1ced37f4e55b173cc32f6e1ca676863df9af0624170b520dcf1bbc50a022278c7664da55ebe317d3
|
|
7
|
+
data.tar.gz: 04f8aaeacea73a571b562752a7f525d607ea9f601e64dd147fb5d3f2bf75653764aa458610876b28609d12d93dd0113d4fcf3069ddbd9fee06159ee01a59cc20
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
## master (unreleased)
|
|
2
2
|
|
|
3
|
+
## 0.31.1 (2025-11-11)
|
|
4
|
+
|
|
5
|
+
- Do not attempt running background migrations on database with `database_tasks: false`
|
|
6
|
+
|
|
7
|
+
## 0.31.0 (2025-10-22)
|
|
8
|
+
|
|
9
|
+
- Store backtraces for failed background data migrations jobs
|
|
10
|
+
- Make `add_column` idempotent
|
|
11
|
+
- Fix `NullLockRetrier#with_lock_retries` method signature
|
|
12
|
+
|
|
3
13
|
## 0.30.0 (2025-10-17)
|
|
4
14
|
|
|
5
15
|
- Fix `remove_check_constraint` when using `:if_exists`
|
|
@@ -630,6 +630,19 @@ module OnlineMigrations
|
|
|
630
630
|
remove_check_constraint(table_name, name: name)
|
|
631
631
|
end
|
|
632
632
|
|
|
633
|
+
# Extends default method to be idempotent and automatically recreate invalid indexes.
|
|
634
|
+
#
|
|
635
|
+
# @see https://api.rubyonrails.org/v8.1/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_column
|
|
636
|
+
#
|
|
637
|
+
def add_column(table_name, column_name, type, **options)
|
|
638
|
+
if column_exists?(table_name, column_name, type, **options)
|
|
639
|
+
Utils.say("Column was not added because it already exists (this may be due to an aborted migration " \
|
|
640
|
+
"or similar) table_name: #{table_name}, column_name: #{column_name}")
|
|
641
|
+
else
|
|
642
|
+
super
|
|
643
|
+
end
|
|
644
|
+
end
|
|
645
|
+
|
|
633
646
|
# Adds a reference to the table with minimal locking
|
|
634
647
|
#
|
|
635
648
|
# Active Record adds an index non-`CONCURRENTLY` to references by default, which blocks writes.
|
|
@@ -127,7 +127,14 @@ module OnlineMigrations
|
|
|
127
127
|
# This is the way that currently is used in ActiveRecord tests themselves.
|
|
128
128
|
pool_manager = ActiveRecord::Base.connection_handler.send(:get_pool_manager, ancestor.name)
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
if pool_manager
|
|
131
|
+
shards_with_database_tasks = pool_manager.shard_names.select do |shard_name|
|
|
132
|
+
pool_config = pool_manager.get_pool_config(:writing, shard_name)
|
|
133
|
+
pool_config.db_config.database_tasks? if pool_config
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
return shards_with_database_tasks
|
|
137
|
+
end
|
|
131
138
|
end
|
|
132
139
|
end
|
|
133
140
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: online_migrations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.31.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- fatkodima
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-
|
|
10
|
+
date: 2025-11-11 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activerecord
|