active_record_shards 3.6.2 → 3.6.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fe1a0e108ca214d83011674329c5b74e25bd258
|
4
|
+
data.tar.gz: 8b49b4c6af876d50bb682cd343e9ecbe764adb3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b05dd1f52e2ce8ebe90ad20f6720f673d8678f41adada752a194fa2fc64d6add00da6f44b7c20e03693ba1f05904fe8580be0f449269512ead30cd8090b8097b
|
7
|
+
data.tar.gz: c651051f455d93e4bf9b60af647749875e18a82ec5d873cf23056592baa846240caca4a838bf5c505989c37be4e5f81651c2003ba9395a6836e54fae529a9ca5
|
@@ -70,7 +70,7 @@ module ActiveRecordShards
|
|
70
70
|
else
|
71
71
|
MasterSlaveProxy.new(self, which)
|
72
72
|
end
|
73
|
-
|
73
|
+
end
|
74
74
|
|
75
75
|
# Executes queries using the slave database. Fails over to master if no slave is found.
|
76
76
|
# if you want to execute a block of code on the slave you can go:
|
@@ -238,7 +238,6 @@ module ActiveRecordShards
|
|
238
238
|
|
239
239
|
def autoload_adapter(adapter_name)
|
240
240
|
begin
|
241
|
-
require 'rubygems'
|
242
241
|
gem "activerecord-#{adapter_name}-adapter"
|
243
242
|
require "active_record/connection_adapters/#{adapter_name}_adapter"
|
244
243
|
rescue LoadError
|
@@ -249,7 +248,6 @@ module ActiveRecordShards
|
|
249
248
|
end
|
250
249
|
end
|
251
250
|
|
252
|
-
adapter_method = "#{adapter_name}_connection"
|
253
251
|
if !ActiveRecord::Base.respond_to?(adapter_name + "_connection")
|
254
252
|
raise AdapterNotFound, "database configuration specifies nonexistent #{adapter_name} adapter"
|
255
253
|
end
|
@@ -43,10 +43,10 @@ module ActiveRecordShards
|
|
43
43
|
|
44
44
|
class << self
|
45
45
|
def columns_with_default_slave(*args, &block)
|
46
|
-
if on_slave_by_default? && !Thread.current[:_active_record_shards_slave_off]
|
47
|
-
|
46
|
+
read_columns_from = if on_slave_by_default? && !Thread.current[:_active_record_shards_slave_off]
|
47
|
+
:slave
|
48
48
|
else
|
49
|
-
|
49
|
+
:master
|
50
50
|
end
|
51
51
|
|
52
52
|
on_cx_switch_block(read_columns_from, :construct_ro_scope => false) { columns_without_default_slave(*args, &block) }
|
@@ -89,9 +89,9 @@ module ActiveRecordShards
|
|
89
89
|
|
90
90
|
module ActiveRelationPatches
|
91
91
|
def self.included(base)
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
[:calculate, :exists?, :pluck, :find_with_associations].each do |m|
|
93
|
+
ActiveRecordShards::DefaultSlavePatches.wrap_method_in_on_slave(false, base, m)
|
94
|
+
end
|
95
95
|
end
|
96
96
|
|
97
97
|
def on_slave_unless_tx
|
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.6.
|
4
|
+
version: 3.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mick Staugaard
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -170,7 +170,6 @@ files:
|
|
170
170
|
- lib/active_record_shards/default_slave_patches.rb
|
171
171
|
- lib/active_record_shards/migration.rb
|
172
172
|
- lib/active_record_shards/model.rb
|
173
|
-
- lib/active_record_shards/schema_cache_extension.rb
|
174
173
|
- lib/active_record_shards/schema_dumper_extension.rb
|
175
174
|
- lib/active_record_shards/shard_selection.rb
|
176
175
|
- lib/active_record_shards/shard_support.rb
|
@@ -195,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
194
|
version: '0'
|
196
195
|
requirements: []
|
197
196
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.5.
|
197
|
+
rubygems_version: 2.4.5.1
|
199
198
|
signing_key:
|
200
199
|
specification_version: 4
|
201
200
|
summary: Simple database switching for ActiveRecord.
|
@@ -1,34 +0,0 @@
|
|
1
|
-
unless (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR > 2) || ActiveRecord::VERSION::MAJOR > 4
|
2
|
-
ActiveRecord::ConnectionAdapters::ConnectionPool.class_eval do
|
3
|
-
attr_accessor :schema_cache
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
alias :original_new_connection :new_connection
|
8
|
-
|
9
|
-
def new_connection
|
10
|
-
original_new_connection.tap do |connection|
|
11
|
-
if schema_cache
|
12
|
-
connection.schema_cache = schema_cache.dup
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
ActiveRecord::ConnectionAdapters::SchemaCache.class_eval do
|
19
|
-
def initialize_dup(other)
|
20
|
-
super
|
21
|
-
|
22
|
-
@columns = @columns.dup
|
23
|
-
@columns_hash = @columns_hash.dup
|
24
|
-
@primary_keys = @primary_keys.dup
|
25
|
-
@tables = @tables.dup
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
unless ActiveRecord::VERSION::MAJOR > 4
|
31
|
-
ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
|
32
|
-
attr_writer :schema_cache
|
33
|
-
end
|
34
|
-
end
|