active_record_shards 3.11.5 → 3.12.0.beta1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b58db094b64e706872768e27a2c92827d182f5cde938b974de333ad99c911e2
|
4
|
+
data.tar.gz: c6bd4169b99f66409c0bf8576e79bd34f567ed92e88c00abcfd4d8ce9a9d3f02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbe1f3c052a2594c13c817e7fb06894b38582f4bde8656347eace28217ac349f689e4326fd3f5c941bf7075db3232c038b7ae47effdc80d0778a5304d978ae78
|
7
|
+
data.tar.gz: b2fae9dd53cf66ec159a2d67eec9d65432b47dcee687111295839755e3e69c05c5f40f2805cc47ed37096479004b7d59e9c3c6b5eb5d6c7d0217363a7ebdd29d
|
@@ -100,7 +100,10 @@ module ActiveRecordShards
|
|
100
100
|
|
101
101
|
module ActiveRelationPatches
|
102
102
|
def self.included(base)
|
103
|
-
[
|
103
|
+
[
|
104
|
+
:calculate, :exists?, :pluck,
|
105
|
+
ActiveRecord::VERSION::MAJOR >= 4 ? :load : :find_with_associations
|
106
|
+
].each do |m|
|
104
107
|
ActiveRecordShards::DefaultSlavePatches.wrap_method_in_on_slave(false, base, m)
|
105
108
|
end
|
106
109
|
end
|
@@ -1,25 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module ActiveRecord
|
3
3
|
class Migrator
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
ActiveRecord::Base.on_all_shards do
|
11
|
-
send("#{m}_without_sharding", *args)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
alias_method :"#{m}_without_sharding", m.to_sym
|
15
|
-
alias_method m.to_sym, :"#{m}_with_sharding"
|
4
|
+
def self.shards_migration_context
|
5
|
+
if ActiveRecord::VERSION::STRING >= '5.2.0'
|
6
|
+
ActiveRecord::MigrationContext.new(['db/migrate'])
|
7
|
+
else
|
8
|
+
self
|
16
9
|
end
|
17
10
|
end
|
18
11
|
|
12
|
+
def run_with_sharding
|
13
|
+
ActiveRecord::Base.on_shard(nil) { run_without_sharding }
|
14
|
+
ActiveRecord::Base.on_all_shards { run_without_sharding }
|
15
|
+
end
|
16
|
+
alias_method :run_without_sharding, :run
|
17
|
+
alias_method :run, :run_with_sharding
|
18
|
+
|
19
|
+
def migrate_with_sharding
|
20
|
+
ActiveRecord::Base.on_shard(nil) { migrate_without_sharding }
|
21
|
+
ActiveRecord::Base.on_all_shards { migrate_without_sharding }
|
22
|
+
end
|
23
|
+
alias_method :migrate_without_sharding, :migrate
|
24
|
+
alias_method :migrate, :migrate_with_sharding
|
25
|
+
|
19
26
|
# don't allow Migrator class to cache versions
|
20
27
|
undef migrated
|
21
28
|
def migrated
|
22
|
-
self.class.get_all_versions
|
29
|
+
self.class.shards_migration_context.get_all_versions
|
23
30
|
end
|
24
31
|
|
25
32
|
# list of pending migrations is any migrations that haven't run on all shards.
|
@@ -38,7 +45,7 @@ module ActiveRecord
|
|
38
45
|
missing = {}
|
39
46
|
|
40
47
|
collect = lambda do |shard|
|
41
|
-
migrated = get_all_versions
|
48
|
+
migrated = shards_migration_context.get_all_versions
|
42
49
|
|
43
50
|
p = versions - migrated
|
44
51
|
pending[shard] = p if p.any?
|
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.
|
4
|
+
version: 3.12.0.beta1
|
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: 2018-
|
13
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 3.2.16
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '
|
24
|
+
version: '6.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
version: 3.2.16
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '6.0'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: activesupport
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
version: 3.2.16
|
42
42
|
- - "<"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: '
|
44
|
+
version: '6.0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
version: 3.2.16
|
52
52
|
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '6.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: wwtd
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,9 +224,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
224
224
|
version: '2.0'
|
225
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- - "
|
227
|
+
- - ">"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
229
|
+
version: 1.3.1
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project:
|
232
232
|
rubygems_version: 2.7.6
|