strong_migrations 1.1.0 → 1.2.0
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: 4c0ea5c8cf3e904b89b8c4ab2f28ff60031515e40edf5b0c617ca4b8f8249650
|
4
|
+
data.tar.gz: 5cb0fd63058bf618595cd929ef90de3cf90f02963f0adca21182c578f41c3320
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50db9d240d49b60b75d97c76765b8f5e3b252c2cc826bd5e50e9b57311082dfea2c9cc5790fd905a2eac45a3eb6afb2784c7ed7962dcaf0172157548e1c8d233
|
7
|
+
data.tar.gz: 2f2e5311cad061b712ee9dfb69a41b5e81f31be8db257bd095cbd8124bc461551afebb305d95b0bb090d6f7ef85c61618d61e64e9b73f266338a0aa7f5101b53
|
data/CHANGELOG.md
CHANGED
@@ -13,11 +13,10 @@ module StrongMigrations
|
|
13
13
|
@version ||= begin
|
14
14
|
target_version(StrongMigrations.target_postgresql_version) do
|
15
15
|
version = select_all("SHOW server_version_num").first["server_version_num"].to_i
|
16
|
+
# major and minor version
|
16
17
|
if version >= 100000
|
17
|
-
#
|
18
|
-
"#{version / 10000}"
|
18
|
+
"#{version / 10000}.#{(version % 10000)}"
|
19
19
|
else
|
20
|
-
# major and minor version for < 10
|
21
20
|
"#{version / 10000}.#{(version % 10000) / 100}"
|
22
21
|
end
|
23
22
|
end
|
@@ -160,6 +159,13 @@ module StrongMigrations
|
|
160
159
|
select_all(query.squish).any?
|
161
160
|
end
|
162
161
|
|
162
|
+
# only check in non-developer environments (where actual server version is used)
|
163
|
+
def index_corruption?
|
164
|
+
server_version >= Gem::Version.new("14.0") &&
|
165
|
+
server_version < Gem::Version.new("14.4") &&
|
166
|
+
!StrongMigrations.developer_env?
|
167
|
+
end
|
168
|
+
|
163
169
|
private
|
164
170
|
|
165
171
|
def set_timeout(setting, timeout)
|
@@ -98,6 +98,11 @@ Then add the NOT NULL constraint in separate migrations."
|
|
98
98
|
raise_error :add_index_columns, header: "Best practice"
|
99
99
|
end
|
100
100
|
|
101
|
+
# safe_by_default goes through this path as well
|
102
|
+
if postgresql? && options[:algorithm] == :concurrently && adapter.index_corruption?
|
103
|
+
raise_error :add_index_corruption
|
104
|
+
end
|
105
|
+
|
101
106
|
# safe to add non-concurrently to new tables (even after inserting data)
|
102
107
|
# since the table won't be in use by the application
|
103
108
|
if postgresql? && options[:algorithm] != :concurrently && !new_table?(table)
|
@@ -128,6 +128,11 @@ end",
|
|
128
128
|
"Adding a non-unique index with more than three columns rarely improves performance.
|
129
129
|
Instead, start an index with columns that narrow down the results the most.",
|
130
130
|
|
131
|
+
add_index_corruption:
|
132
|
+
"Adding an index concurrently can cause silent data corruption in Postgres 14.0 to 14.3.
|
133
|
+
Upgrade Postgres before adding new indexes, or wrap this step in a safety_assured { ... } block
|
134
|
+
to accept the risk.",
|
135
|
+
|
131
136
|
change_table:
|
132
137
|
"Strong Migrations does not support inspecting what happens inside a
|
133
138
|
change_table block, so cannot help you here. Please make really sure that what
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-06-
|
13
|
+
date: 2022-06-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|