safe-pg-migrations 1.2.0 → 1.2.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: fbda5becc48b8f9c7e0f45820f5f9ef908ba1f1fe56c306f03d3f76fb0197741
|
4
|
+
data.tar.gz: 4e88da86831d71cb440e1409ad52f3591aabcbd26de248507daffbec0e17698d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7dfbc18db1959f66a104e37d1f880934b369338b96435efc2db851fe80c092e9cf1e19a092274726dcb35da2fb05035d71a63e404dc89366de6c3483ce2131f
|
7
|
+
data.tar.gz: a176ae5e044b31ef271359aa9342698e1744e00c3fe99eb8f10c65fa77127671bf5265f4a4e65117df2f22bbc01bbc201ea22ecd2e0faca36e0822cc2f85e2b9
|
@@ -4,7 +4,7 @@ module SafePgMigrations
|
|
4
4
|
module StatementInsurer
|
5
5
|
PG_11_VERSION_NUM = 110_000
|
6
6
|
|
7
|
-
%i[change_column_null change_column
|
7
|
+
%i[change_column_null change_column].each do |method|
|
8
8
|
define_method method do |*args, &block|
|
9
9
|
with_setting(:statement_timeout, SafePgMigrations.config.pg_safe_timeout) { super(*args, &block) }
|
10
10
|
end
|
@@ -46,8 +46,25 @@ module SafePgMigrations
|
|
46
46
|
without_statement_timeout { validate_foreign_key from_table, options_or_to_table } unless validate_present
|
47
47
|
end
|
48
48
|
|
49
|
+
def create_table(*)
|
50
|
+
with_setting(:statement_timeout, SafePgMigrations.config.pg_safe_timeout) do
|
51
|
+
super do |td|
|
52
|
+
yield td if block_given?
|
53
|
+
td.indexes.map! do |key, index_options|
|
54
|
+
index_options[:algorithm] ||= :default
|
55
|
+
[key, index_options]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
49
61
|
def add_index(table_name, column_name, **options)
|
50
|
-
options[:algorithm]
|
62
|
+
if options[:algorithm] == :default
|
63
|
+
options.delete :algorithm
|
64
|
+
else
|
65
|
+
options[:algorithm] = :concurrently
|
66
|
+
end
|
67
|
+
|
51
68
|
SafePgMigrations.say_method_call(:add_index, table_name, column_name, options)
|
52
69
|
|
53
70
|
without_timeout { super }
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe-pg-migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Prat
|
8
8
|
- Romain Choquet
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -174,7 +174,7 @@ homepage: https://github.com/doctolib/safe-pg-migrations
|
|
174
174
|
licenses:
|
175
175
|
- MIT
|
176
176
|
metadata: {}
|
177
|
-
post_install_message:
|
177
|
+
post_install_message:
|
178
178
|
rdoc_options: []
|
179
179
|
require_paths:
|
180
180
|
- lib
|
@@ -189,9 +189,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
rubyforge_project:
|
192
|
+
rubyforge_project:
|
193
193
|
rubygems_version: 2.7.3
|
194
|
-
signing_key:
|
194
|
+
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Make your PG migrations safe.
|
197
197
|
test_files: []
|