active_record_shards 3.19.1 → 3.19.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record_shards/configuration_parser.rb +16 -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: c92296c3b3a78ff97323797b16a0f110a473bf149713e901b178eac343148d18
|
4
|
+
data.tar.gz: b74a33acb7c8a55cfecc211013e7871ca8710b726c969cadb8937495a6fdfba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2a16d3380ebf680180c848bd7b64b838e9bb729470943e7016e3cca2f07135a4b8c45c11ab8d4476b76dc1c3a8b735ac29ed14de95d1972d0aaca327ff0892
|
7
|
+
data.tar.gz: 9afeb1052dd9a4f79f1c49e9c69a9e148e226ae90e8bee891376994e061988bd7290ca56fa36f992597dd978c7adb6fdcc753b89f1d8355c03766f38a890f5f8
|
@@ -41,6 +41,19 @@ module ActiveRecordShards
|
|
41
41
|
conf
|
42
42
|
end
|
43
43
|
|
44
|
+
def replace_slave_keys(conf)
|
45
|
+
conf.to_a.each do |env_name, env_config|
|
46
|
+
next unless env_name.end_with?("_slave")
|
47
|
+
|
48
|
+
replica_key = env_name.sub(/_slave$/, "_replica")
|
49
|
+
next if conf.key?(replica_key)
|
50
|
+
|
51
|
+
conf[replica_key] = env_config.deep_dup
|
52
|
+
end
|
53
|
+
|
54
|
+
conf
|
55
|
+
end
|
56
|
+
|
44
57
|
def expand_child!(parent, child)
|
45
58
|
parent.each do |key, value|
|
46
59
|
unless ['slave', 'replica', 'shards'].include?(key) || value.is_a?(Hash)
|
@@ -50,7 +63,9 @@ module ActiveRecordShards
|
|
50
63
|
end
|
51
64
|
|
52
65
|
def configurations_with_shard_explosion=(conf)
|
53
|
-
|
66
|
+
exploded_configuration = explode(conf)
|
67
|
+
configuration_with_slave_keys_replaced = replace_slave_keys(exploded_configuration)
|
68
|
+
self.configurations_without_shard_explosion = configuration_with_slave_keys_replaced
|
54
69
|
end
|
55
70
|
|
56
71
|
def self.extended(base)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_shards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.19.
|
4
|
+
version: 3.19.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Quorning
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: activerecord
|
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
232
|
- !ruby/object:Gem::Version
|
233
233
|
version: '0'
|
234
234
|
requirements: []
|
235
|
-
rubygems_version: 3.
|
235
|
+
rubygems_version: 3.3.1
|
236
236
|
signing_key:
|
237
237
|
specification_version: 4
|
238
238
|
summary: Simple database switching for ActiveRecord.
|