online_migrations 0.5.0 → 0.5.1
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: 95f3b31c9fe8edb868fade7dbdaed0ebf78d53da7a1ff52786a748663bc93bf5
|
4
|
+
data.tar.gz: 94c2fed042d39993d85f6641db3b4a86c3a360b3c858f48aeb2da052bb2c52cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f844aa5e502a91739923039a8fb84d10ae9682404bd14bd4b92352400c6dae82963b21166178c72c47ea4ecbd0792b6f46da151d92ce205e217a5788c9a8b27a
|
7
|
+
data.tar.gz: 2db40b6b3cf81f923251f16a023aedbb18f8f24d28abb9e6b638090030c013c24dd6a41942df3e4f4cd1264c84c997eaaeb6adcb1c2d8d8844bc4934406f9ebc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## master (unreleased)
|
2
2
|
|
3
|
+
## 0.5.1 (2022-07-19)
|
4
|
+
|
5
|
+
- Raise for possible index corruption in all environments (previously, the check was made only
|
6
|
+
in the production environment)
|
7
|
+
|
3
8
|
## 0.5.0 (2022-06-23)
|
4
9
|
|
5
10
|
- Added check for index corruption with PostgreSQL 14.0 to 14.3
|
@@ -100,7 +100,7 @@ module OnlineMigrations
|
|
100
100
|
end.to_h
|
101
101
|
|
102
102
|
if (extra_keys = (options.keys - conversions.keys)).any?
|
103
|
-
raise ArgumentError, "Options has unknown keys: #{extra_keys.map(&:inspect).join(', ')}. "\
|
103
|
+
raise ArgumentError, "Options has unknown keys: #{extra_keys.map(&:inspect).join(', ')}. " \
|
104
104
|
"Can contain only column names: #{conversions.keys.map(&:inspect).join(', ')}."
|
105
105
|
end
|
106
106
|
|
@@ -400,7 +400,7 @@ module OnlineMigrations
|
|
400
400
|
|
401
401
|
# This is necessary as we can't properly rename indexes such as "taggings_idx".
|
402
402
|
unless index.name.include?(from_column)
|
403
|
-
raise "The index #{index.name} can not be copied as it does not "\
|
403
|
+
raise "The index #{index.name} can not be copied as it does not " \
|
404
404
|
"mention the old column. You have to rename this index manually first."
|
405
405
|
end
|
406
406
|
|
@@ -597,15 +597,14 @@ module OnlineMigrations
|
|
597
597
|
if Utils.developer_env? && (target_version = OnlineMigrations.config.target_version)
|
598
598
|
target_version.to_s
|
599
599
|
else
|
600
|
-
|
601
|
-
|
602
|
-
database_version
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
major
|
608
|
-
"#{major}.#{minor}.#{patch}"
|
600
|
+
database_version = connection.select_value("SHOW server_version_num").to_i
|
601
|
+
major = database_version / 10000
|
602
|
+
if database_version >= 100000
|
603
|
+
minor = database_version % 10000
|
604
|
+
else
|
605
|
+
minor = (database_version % 10000) / 100
|
606
|
+
end
|
607
|
+
"#{major}.#{minor}"
|
609
608
|
end
|
610
609
|
|
611
610
|
Gem::Version.new(version)
|
@@ -745,8 +744,7 @@ module OnlineMigrations
|
|
745
744
|
|
746
745
|
def index_corruption?
|
747
746
|
postgresql_version >= Gem::Version.new("14.0") &&
|
748
|
-
postgresql_version < Gem::Version.new("14.4")
|
749
|
-
!Utils.developer_env?
|
747
|
+
postgresql_version < Gem::Version.new("14.4")
|
750
748
|
end
|
751
749
|
|
752
750
|
def run_custom_checks(method, args)
|
@@ -404,7 +404,7 @@ module OnlineMigrations
|
|
404
404
|
batch_options = options.extract!(:batch_size, :batch_column_name, :progress, :pause_ms)
|
405
405
|
|
406
406
|
if column_exists?(table_name, column_name)
|
407
|
-
Utils.say("Column was not created because it already exists (this may be due to an aborted migration "\
|
407
|
+
Utils.say("Column was not created because it already exists (this may be due to an aborted migration " \
|
408
408
|
"or similar) table_name: #{table_name}, column_name: #{column_name}")
|
409
409
|
else
|
410
410
|
transaction do
|
@@ -655,7 +655,7 @@ module OnlineMigrations
|
|
655
655
|
schema = __schema_for_table(table_name)
|
656
656
|
|
657
657
|
if __index_valid?(index_name, schema: schema)
|
658
|
-
Utils.say("Index was not created because it already exists (this may be due to an aborted migration "\
|
658
|
+
Utils.say("Index was not created because it already exists (this may be due to an aborted migration " \
|
659
659
|
"or similar): table_name: #{table_name}, column_name: #{column_name}")
|
660
660
|
return
|
661
661
|
else
|
@@ -699,7 +699,7 @@ module OnlineMigrations
|
|
699
699
|
end
|
700
700
|
end
|
701
701
|
else
|
702
|
-
Utils.say("Index was not removed because it does not exist (this may be due to an aborted migration "\
|
702
|
+
Utils.say("Index was not removed because it does not exist (this may be due to an aborted migration " \
|
703
703
|
"or similar): table_name: #{table_name}, column_name: #{column_names}")
|
704
704
|
end
|
705
705
|
end
|
@@ -768,7 +768,7 @@ module OnlineMigrations
|
|
768
768
|
constraint_name = __check_constraint_name(table_name, expression: expression, **options)
|
769
769
|
|
770
770
|
if __check_constraint_exists?(table_name, constraint_name)
|
771
|
-
Utils.say("Check constraint was not created because it already exists (this may be due to an aborted migration "\
|
771
|
+
Utils.say("Check constraint was not created because it already exists (this may be due to an aborted migration " \
|
772
772
|
"or similar) table_name: #{table_name}, expression: #{expression}, constraint name: #{constraint_name}")
|
773
773
|
else
|
774
774
|
query = "ALTER TABLE #{table_name} ADD CONSTRAINT #{constraint_name} CHECK (#{expression})"
|
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.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fatkodima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|