online_migrations 0.19.4 → 0.19.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd8711d56259535675633074868019a5c4b3de068bb30d783c9ae16dc906afb1
|
4
|
+
data.tar.gz: 3b417e176d143092d69e4551c1f96a32e1a2acf1d74d268fc33f9b5a598be553
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad26fd5662f2636479b697933042b8d7e60b4ee42f136ddeb8cff8256c65a4491b8017d09d2da849faf65cb6f8d4ecc95595816b7669c8364e9f31bbe75232c4
|
7
|
+
data.tar.gz: 21fec027462ff6f96baaf0fc65d186fc68fefbb50fd3de6af8f561aae691e6f9909d70d7053557d39f0a56ea498841816c2853cce0b1acef161411b2d968b196
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## master (unreleased)
|
2
2
|
|
3
|
+
## 0.19.6 (2024-09-26)
|
4
|
+
|
5
|
+
- Fix `add_refernce_concurrently` when adding non polymorphic references
|
6
|
+
- Fix progress for background migrations with small number of records
|
7
|
+
|
8
|
+
## 0.19.5 (2024-09-20)
|
9
|
+
|
10
|
+
- Fix `add_reference_concurrently` when adding polymorphic references
|
11
|
+
|
3
12
|
## 0.19.4 (2024-09-02)
|
4
13
|
|
5
14
|
- Fix an edge case for background schema migrations
|
@@ -138,7 +138,7 @@ module OnlineMigrations
|
|
138
138
|
progresses.sum.round(2)
|
139
139
|
end
|
140
140
|
elsif rows_count
|
141
|
-
if rows_count > 0
|
141
|
+
if rows_count > 0 && rows_count > batch_size
|
142
142
|
jobs_rows_count = migration_jobs.succeeded.sum(:batch_size)
|
143
143
|
# The last migration job may need to process the amount of rows
|
144
144
|
# less than the batch size, so we can get a value > 1.0.
|
@@ -183,14 +183,14 @@ module OnlineMigrations
|
|
183
183
|
def retry
|
184
184
|
if composite? && failed?
|
185
185
|
children.failed.each(&:retry)
|
186
|
-
|
186
|
+
enqueued!
|
187
187
|
true
|
188
188
|
elsif failed?
|
189
189
|
iterator = BatchIterator.new(migration_jobs.failed)
|
190
190
|
iterator.each_batch(of: 100) do |batch|
|
191
191
|
batch.each(&:retry)
|
192
192
|
end
|
193
|
-
|
193
|
+
enqueued!
|
194
194
|
true
|
195
195
|
else
|
196
196
|
false
|
@@ -647,21 +647,29 @@ module OnlineMigrations
|
|
647
647
|
__ensure_not_in_transaction!
|
648
648
|
|
649
649
|
column_name = "#{ref_name}_id"
|
650
|
+
type_column_name = "#{ref_name}_type"
|
651
|
+
|
650
652
|
if !column_exists?(table_name, column_name)
|
651
653
|
type = options[:type] || :bigint
|
652
654
|
allow_null = options.fetch(:null, true)
|
653
655
|
add_column(table_name, column_name, type, null: allow_null)
|
654
656
|
end
|
655
657
|
|
658
|
+
if options[:polymorphic] && !column_exists?(table_name, type_column_name)
|
659
|
+
allow_null = options[:polymorphic].is_a?(Hash) ? options[:polymorphic][:null] : true
|
660
|
+
add_column(table_name, type_column_name, :string, null: allow_null)
|
661
|
+
end
|
662
|
+
|
656
663
|
# Always added by default in 5.0+
|
657
664
|
index = options.fetch(:index, true)
|
658
665
|
|
659
666
|
if index
|
660
667
|
index = {} if index == true
|
661
668
|
index_columns = [column_name]
|
669
|
+
|
662
670
|
if options[:polymorphic]
|
671
|
+
index_columns.unshift(type_column_name)
|
663
672
|
index[:name] ||= "index_#{table_name}_on_#{ref_name}"
|
664
|
-
index_columns.unshift("#{ref_name}_type")
|
665
673
|
end
|
666
674
|
|
667
675
|
add_index(table_name, index_columns, **index.merge(algorithm: :concurrently))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: online_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fatkodima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|