nandi 2.0.0 → 2.1.0
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 +4 -4
- data/lib/nandi/multi_database.rb +20 -1
- data/lib/nandi/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: 0bcecda52a441da340e251adb8b8c0e3e323579fb10df1d23ca1612867f8cd9a
|
|
4
|
+
data.tar.gz: 7c56e3cf4f93f97e7a62b2b180b977ee21b7f199b49b8989acdcaa3a8f918b81
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf4c111c2982f1e4ae8aa6c1b8b83f04b084a1adf2eb2da1af375c7b26de608db76da6aafbbb799dc5b26b53c9021e8912d84bd3f25987160aaf71dec7a4a546
|
|
7
|
+
data.tar.gz: '09f340dd4c6a435047e326b424b07450715f04594bd326d6a01cdd12e3ed6e222f5e5dc06f11a9174b0b429857b6f1d80419f49b63fd35c979ad2a439829e49e'
|
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,11 @@ module Nandi
|
|
|
374
374
|
end
|
|
375
375
|
|
|
376
376
|
def default_statement_timeout
|
|
377
|
-
Nandi.config.access_exclusive_statement_timeout
|
|
377
|
+
Nandi.config.concurrent_statement_timeout || Nandi.config.access_exclusive_statement_timeout
|
|
378
378
|
end
|
|
379
379
|
|
|
380
380
|
def default_lock_timeout
|
|
381
|
-
Nandi.config.access_exclusive_lock_timeout
|
|
381
|
+
Nandi.config.concurrent_lock_timeout || Nandi.config.access_exclusive_lock_timeout
|
|
382
382
|
end
|
|
383
383
|
|
|
384
384
|
def invoke_custom_method(name, ...)
|
data/lib/nandi/multi_database.rb
CHANGED
|
@@ -50,17 +50,30 @@ 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
|
|
56
68
|
|
|
57
|
-
attr_reader :name, :default
|
|
69
|
+
attr_reader :name, :default, :raw_config
|
|
58
70
|
|
|
59
71
|
attr_accessor :migration_directory,
|
|
60
72
|
:lockfile_name
|
|
61
73
|
|
|
62
74
|
def initialize(name:, config:)
|
|
63
75
|
@name = name
|
|
76
|
+
@raw_config = config
|
|
64
77
|
@default = @name == :primary || config[:default] == true
|
|
65
78
|
|
|
66
79
|
# Paths and files
|
|
@@ -86,6 +99,8 @@ module Nandi
|
|
|
86
99
|
config[:concurrent_lock_timeout_limit] || DEFAULT_CONCURRENT_TIMEOUT_LIMIT
|
|
87
100
|
@concurrent_statement_timeout_limit =
|
|
88
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]
|
|
89
104
|
end
|
|
90
105
|
|
|
91
106
|
def path_prefix(name, default)
|
|
@@ -115,6 +130,10 @@ module Nandi
|
|
|
115
130
|
|
|
116
131
|
def register(name, config)
|
|
117
132
|
name = name.to_sym
|
|
133
|
+
|
|
134
|
+
# Allow re-registration with identical config (for Rails reloading)
|
|
135
|
+
return @databases[name] if @databases.key?(name) && @databases[name].raw_config == config
|
|
136
|
+
|
|
118
137
|
raise ArgumentError, "Database #{name} already registered" if @databases.key?(name)
|
|
119
138
|
|
|
120
139
|
@databases[name] = Database.new(name: name, config: config)
|
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.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GoCardless Engineering
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-06-05 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activesupport
|