nandi 2.0.1 → 2.1.1
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/lib/nandi/config.rb +4 -0
- data/lib/nandi/instructions/add_index.rb +1 -1
- data/lib/nandi/migration.rb +12 -4
- data/lib/nandi/multi_database.rb +14 -0
- data/lib/nandi/validator.rb +1 -1
- data/lib/nandi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70ecd10143c43ea10379b4dc7c6d1bbf4d4bc3d654cbf15dde273b49cf229a08
|
|
4
|
+
data.tar.gz: 0b64d84387f9e4be7eed24ddadc9f74d58d118cca7d91e0e526f680ee5fcfba8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8f057aa2c71d7169d6482a2fbc2fe7fb4721bfeef3b650a74c09e002fe9b7eff4fa3479b5e2c0af7940d91d88ca71dcddab0fbd169077fee1ec00cb26e447f60
|
|
7
|
+
data.tar.gz: 112cc9d2d08c4802767d2c481d11f30ff87844c765a0afcb0224dcb1bbfc1c69dc4d7c6dd618a79d744bb7fdff03f2945f216f2eba90511d99b6c4ad58fcdd59
|
data/lib/nandi/config.rb
CHANGED
|
@@ -78,6 +78,8 @@ module Nandi
|
|
|
78
78
|
def access_exclusive_statement_timeout_limit(database_name = nil) = config(database_name).access_exclusive_statement_timeout_limit
|
|
79
79
|
def concurrent_lock_timeout_limit(database_name = nil) = config(database_name).concurrent_lock_timeout_limit
|
|
80
80
|
def concurrent_statement_timeout_limit(database_name = nil) = config(database_name).concurrent_statement_timeout_limit
|
|
81
|
+
def concurrent_lock_timeout(database_name = nil) = config(database_name).concurrent_lock_timeout
|
|
82
|
+
def concurrent_statement_timeout(database_name = nil) = config(database_name).concurrent_statement_timeout
|
|
81
83
|
# rubocop:enable Layout/LineLength
|
|
82
84
|
|
|
83
85
|
# Delegate setter methods to the default database for backwards compatibility
|
|
@@ -89,6 +91,8 @@ module Nandi
|
|
|
89
91
|
:access_exclusive_statement_timeout_limit=,
|
|
90
92
|
:concurrent_lock_timeout_limit=,
|
|
91
93
|
:concurrent_statement_timeout_limit=,
|
|
94
|
+
:concurrent_lock_timeout=,
|
|
95
|
+
:concurrent_statement_timeout=,
|
|
92
96
|
to: :default
|
|
93
97
|
|
|
94
98
|
delegate :validate!, :default, :config, to: :databases
|
data/lib/nandi/migration.rb
CHANGED
|
@@ -329,7 +329,7 @@ module Nandi
|
|
|
329
329
|
|
|
330
330
|
def disable_lock_timeout?
|
|
331
331
|
if self.class.lock_timeout.nil?
|
|
332
|
-
strictest_lock == LockWeights::SHARE
|
|
332
|
+
strictest_lock == LockWeights::SHARE && Nandi.config.concurrent_lock_timeout.nil?
|
|
333
333
|
else
|
|
334
334
|
false
|
|
335
335
|
end
|
|
@@ -337,7 +337,7 @@ module Nandi
|
|
|
337
337
|
|
|
338
338
|
def disable_statement_timeout?
|
|
339
339
|
if self.class.statement_timeout.nil?
|
|
340
|
-
strictest_lock == LockWeights::SHARE
|
|
340
|
+
strictest_lock == LockWeights::SHARE && Nandi.config.concurrent_statement_timeout.nil?
|
|
341
341
|
else
|
|
342
342
|
false
|
|
343
343
|
end
|
|
@@ -374,11 +374,19 @@ module Nandi
|
|
|
374
374
|
end
|
|
375
375
|
|
|
376
376
|
def default_statement_timeout
|
|
377
|
-
|
|
377
|
+
if strictest_lock == LockWeights::SHARE
|
|
378
|
+
Nandi.config.concurrent_statement_timeout || Nandi.config.access_exclusive_statement_timeout
|
|
379
|
+
else
|
|
380
|
+
Nandi.config.access_exclusive_statement_timeout
|
|
381
|
+
end
|
|
378
382
|
end
|
|
379
383
|
|
|
380
384
|
def default_lock_timeout
|
|
381
|
-
|
|
385
|
+
if strictest_lock == LockWeights::SHARE
|
|
386
|
+
Nandi.config.concurrent_lock_timeout || Nandi.config.access_exclusive_lock_timeout
|
|
387
|
+
else
|
|
388
|
+
Nandi.config.access_exclusive_lock_timeout
|
|
389
|
+
end
|
|
382
390
|
end
|
|
383
391
|
|
|
384
392
|
def invoke_custom_method(name, ...)
|
data/lib/nandi/multi_database.rb
CHANGED
|
@@ -50,6 +50,18 @@ module Nandi
|
|
|
50
50
|
# @return [Integer]
|
|
51
51
|
attr_accessor :concurrent_lock_timeout_limit
|
|
52
52
|
|
|
53
|
+
# The default lock timeout for migrations that take place concurrently
|
|
54
|
+
# (eg. add_index, remove_index). When set, concurrent migrations will use
|
|
55
|
+
# set_lock_timeout instead of disable_lock_timeout!. Default: nil (disabled).
|
|
56
|
+
# @return [Integer, nil]
|
|
57
|
+
attr_accessor :concurrent_lock_timeout
|
|
58
|
+
|
|
59
|
+
# The default statement timeout for migrations that take place concurrently
|
|
60
|
+
# (eg. add_index, remove_index). When set, concurrent migrations will use
|
|
61
|
+
# set_statement_timeout instead of disable_statement_timeout!. Default: nil (disabled).
|
|
62
|
+
# @return [Integer, nil]
|
|
63
|
+
attr_accessor :concurrent_statement_timeout
|
|
64
|
+
|
|
53
65
|
# The directory for output files. Default: `db/migrate`
|
|
54
66
|
# @return [String]
|
|
55
67
|
attr_accessor :output_directory
|
|
@@ -87,6 +99,8 @@ module Nandi
|
|
|
87
99
|
config[:concurrent_lock_timeout_limit] || DEFAULT_CONCURRENT_TIMEOUT_LIMIT
|
|
88
100
|
@concurrent_statement_timeout_limit =
|
|
89
101
|
config[:concurrent_statement_timeout_limit] || DEFAULT_CONCURRENT_TIMEOUT_LIMIT
|
|
102
|
+
@concurrent_lock_timeout = config[:concurrent_lock_timeout]
|
|
103
|
+
@concurrent_statement_timeout = config[:concurrent_statement_timeout]
|
|
90
104
|
end
|
|
91
105
|
|
|
92
106
|
def path_prefix(name, default)
|
data/lib/nandi/validator.rb
CHANGED
|
@@ -67,7 +67,7 @@ module Nandi
|
|
|
67
67
|
def new_indexes_are_separated_from_other_migrations
|
|
68
68
|
[migration.up_instructions, migration.down_instructions].map do |instructions|
|
|
69
69
|
instructions.none? { |i| i.procedure == :add_index } ||
|
|
70
|
-
instructions.
|
|
70
|
+
instructions.one?
|
|
71
71
|
end.all?
|
|
72
72
|
end
|
|
73
73
|
|
data/lib/nandi/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nandi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GoCardless Engineering
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activesupport
|
|
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
177
177
|
- !ruby/object:Gem::Version
|
|
178
178
|
version: '0'
|
|
179
179
|
requirements: []
|
|
180
|
-
rubygems_version:
|
|
180
|
+
rubygems_version: 4.0.3
|
|
181
181
|
specification_version: 4
|
|
182
182
|
summary: Fear-free migrations for PostgreSQL
|
|
183
183
|
test_files: []
|