online_migrations 0.19.4 → 0.19.5
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/online_migrations/schema_statements.rb +9 -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: 9cb60167b94f5ce8556b3f9835949c86f9be4c523eb2c35494de578dea31a2bf
|
4
|
+
data.tar.gz: 20d9d6fcf509bbc25987a2e3bce165c927cacd03502aa908c02aba37dd284774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03f82fe701b6d2145963f1f2220ac9ed127dc826885455134afc3bb547197d21a1c0307156b6d8b5402c0a521332328eebf45d96a3bb2183804055d866cd3af2
|
7
|
+
data.tar.gz: 94f0bfd73299897757a8b836a9cbd995bb9313c971a6e0076079b783955c26da239098b84df391096128fc0e060ba66ca69e61e16a84013c12d613c7fe4064ce
|
data/CHANGELOG.md
CHANGED
@@ -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 !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.5
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|