active_record_shards 3.12.0.beta1 → 3.12.0.beta2
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/active_record_shards/shard_selection.rb +14 -15
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef4602ef8dd4f4da902671838cb3c81a9a894befc5ecf4f26679c637d934128e
|
4
|
+
data.tar.gz: be495688e0eb5887a65bf0679c49b2befe0de4c1505bc6d9c7d91c02595b5c87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6a568a5e3f7894a9e64319acc93991bdcd01adae5852bbe19b4e599fe66d1648fd7e13b76530b45625d78c51ed9a95ad31c37b2f4f51f11c8221132626378bc
|
7
|
+
data.tar.gz: 27a84cabdef6e4b5acaadd20a8c500e979548c103cd996d1e68198ecde2d5c021c2a66bef4f95b8acf74c1f4386295b058d15fd8d4e6bd81d55b2574ba795a47
|
@@ -49,22 +49,21 @@ module ActiveRecordShards
|
|
49
49
|
PRIMARY = "primary".freeze
|
50
50
|
def resolve_connection_name(sharded:, configurations:)
|
51
51
|
resolved_shard = sharded ? shard : nil
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
@
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
52
|
+
env = ActiveRecordShards.rails_env
|
53
|
+
|
54
|
+
@connection_names ||= {}
|
55
|
+
@connection_names[env] ||= {}
|
56
|
+
@connection_names[env][resolved_shard] ||= {}
|
57
|
+
@connection_names[env][resolved_shard][@on_slave] ||= begin
|
58
|
+
name = env.dup
|
59
|
+
name << "_shard_#{resolved_shard}" if resolved_shard
|
60
|
+
if @on_slave && configurations["#{name}_slave"]
|
61
|
+
"#{name}_slave"
|
62
|
+
else
|
63
|
+
# ActiveRecord always names its default connection pool 'primary'
|
64
|
+
# while everything else is named by the configuration name
|
65
|
+
resolved_shard ? name : PRIMARY
|
66
66
|
end
|
67
|
-
s
|
68
67
|
end
|
69
68
|
end
|
70
69
|
|
metadata
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_shards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.12.0.
|
4
|
+
version: 3.12.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Benjamin Quorning
|
8
|
+
- Gabe Martin-Dempesy
|
9
|
+
- Pierre Schambacher
|
7
10
|
- Mick Staugaard
|
8
11
|
- Eric Chapweske
|
9
12
|
- Ben Osheroff
|
10
13
|
autorequire:
|
11
14
|
bindir: bin
|
12
15
|
cert_chain: []
|
13
|
-
date: 2018-06-
|
16
|
+
date: 2018-06-14 00:00:00.000000000 Z
|
14
17
|
dependencies:
|
15
18
|
- !ruby/object:Gem::Dependency
|
16
19
|
name: activerecord
|
@@ -180,9 +183,10 @@ dependencies:
|
|
180
183
|
version: 0.2.0
|
181
184
|
description: Easily run queries on shard and slave databases.
|
182
185
|
email:
|
186
|
+
- bquorning@zendesk.com
|
187
|
+
- gabe@zendesk.com
|
188
|
+
- pschambacher@zendesk.com
|
183
189
|
- mick@staugaard.com
|
184
|
-
- eac@zendesk.com
|
185
|
-
- ben@gimbo.net
|
186
190
|
executables: []
|
187
191
|
extensions: []
|
188
192
|
extra_rdoc_files: []
|