switchman 3.5.22 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/switchman/active_record/base.rb +1 -1
- data/lib/switchman/active_record/connection_pool.rb +1 -1
- data/lib/switchman/active_record/pending_migration_connection.rb +11 -0
- data/lib/switchman/active_record/relation.rb +8 -3
- data/lib/switchman/call_super.rb +2 -8
- data/lib/switchman/engine.rb +4 -0
- data/lib/switchman/guard_rail/relation.rb +1 -2
- data/lib/switchman/sharded_instrumenter.rb +2 -2
- data/lib/switchman/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30e02a7b02e23693a5bab2272c0d51d452ca8f22aac18bf869c68280a002a333
|
4
|
+
data.tar.gz: c6e252c1c8fae37d78d801f446ebb6ddeb83c82b89690eda4bff7f8157e93c07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad549fbd26947a8ae1fc61e966741d1541b767429be8f4c3c57b1955390bbab2481629e88450ad31ea6d8ae219801713740841c70a07283028c7ccbcfd60caf
|
7
|
+
data.tar.gz: 9f2481438cdc6d232e758174f405aeb641c1d02467172679cd2cb72ea4cd18569c0a00c626e9514de4dadd76cca2cc7c72dd80e28287e60e9bdd2c2632360021
|
@@ -44,6 +44,12 @@ module Switchman
|
|
44
44
|
primary_shard.activate(klass.connection_class_for_self) { super }
|
45
45
|
end
|
46
46
|
|
47
|
+
if ::Rails.version > "7.1.2"
|
48
|
+
def transaction(...)
|
49
|
+
primary_shard.activate(klass.connection_class_for_self) { super }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
47
53
|
def explain
|
48
54
|
activate { |relation| relation.call_super(:explain, Relation) }
|
49
55
|
end
|
@@ -58,10 +64,9 @@ module Switchman
|
|
58
64
|
end
|
59
65
|
|
60
66
|
%I[update_all delete_all].each do |method|
|
61
|
-
arg_params = (RUBY_VERSION <= "2.8") ? "*args" : "*args, **kwargs"
|
62
67
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
63
|
-
def #{method}(
|
64
|
-
result = self.activate(unordered: true) { |relation| relation.call_super(#{method.inspect}, Relation,
|
68
|
+
def #{method}(*args, **kwargs)
|
69
|
+
result = self.activate(unordered: true) { |relation| relation.call_super(#{method.inspect}, Relation, *args, **kwargs) }
|
65
70
|
result = result.sum if result.is_a?(Array)
|
66
71
|
result
|
67
72
|
end
|
data/lib/switchman/call_super.rb
CHANGED
@@ -12,14 +12,8 @@ module Switchman
|
|
12
12
|
method.super_method
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
super_method_above(method, above_module).call(*args, &block)
|
18
|
-
end
|
19
|
-
else
|
20
|
-
def call_super(method, above_module, *args, **kwargs, &block)
|
21
|
-
super_method_above(method, above_module).call(*args, **kwargs, &block)
|
22
|
-
end
|
15
|
+
def call_super(method, above_module, ...)
|
16
|
+
super_method_above(method, above_module).call(...)
|
23
17
|
end
|
24
18
|
end
|
25
19
|
end
|
data/lib/switchman/engine.rb
CHANGED
@@ -78,6 +78,10 @@ module Switchman
|
|
78
78
|
::ActiveRecord::MigrationContext.prepend(ActiveRecord::MigrationContext)
|
79
79
|
::ActiveRecord::Migrator.prepend(ActiveRecord::Migrator)
|
80
80
|
|
81
|
+
if ::Rails.version > "7.1.3"
|
82
|
+
::ActiveRecord::PendingMigrationConnection.include(ActiveRecord::PendingMigrationConnection)
|
83
|
+
end
|
84
|
+
|
81
85
|
::ActiveRecord::Reflection::AbstractReflection.include(ActiveRecord::Reflection::AbstractReflection)
|
82
86
|
::ActiveRecord::Reflection::AssociationReflection.prepend(ActiveRecord::Reflection::AssociationScopeCache)
|
83
87
|
::ActiveRecord::Reflection::ThroughReflection.prepend(ActiveRecord::Reflection::AssociationScopeCache)
|
@@ -13,9 +13,8 @@ module Switchman
|
|
13
13
|
end
|
14
14
|
|
15
15
|
%w[update_all delete_all].each do |method|
|
16
|
-
arg_params = (RUBY_VERSION <= "2.8") ? "*args" : "*args, **kwargs"
|
17
16
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
18
|
-
def #{method}(
|
17
|
+
def #{method}(*args, **kwargs)
|
19
18
|
db = Shard.current(connection_class_for_self).database_server
|
20
19
|
db.unguard { super }
|
21
20
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Switchman
|
4
4
|
class ShardedInstrumenter < ::SimpleDelegator
|
5
5
|
def initialize(instrumenter, shard_host)
|
6
|
-
super
|
6
|
+
super(instrumenter)
|
7
7
|
@shard_host = shard_host
|
8
8
|
end
|
9
9
|
|
@@ -23,7 +23,7 @@ module Switchman
|
|
23
23
|
end
|
24
24
|
}
|
25
25
|
end
|
26
|
-
super
|
26
|
+
super(name, payload)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/switchman/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switchman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -249,6 +249,7 @@ files:
|
|
249
249
|
- lib/switchman/active_record/log_subscriber.rb
|
250
250
|
- lib/switchman/active_record/migration.rb
|
251
251
|
- lib/switchman/active_record/model_schema.rb
|
252
|
+
- lib/switchman/active_record/pending_migration_connection.rb
|
252
253
|
- lib/switchman/active_record/persistence.rb
|
253
254
|
- lib/switchman/active_record/postgresql_adapter.rb
|
254
255
|
- lib/switchman/active_record/predicate_builder.rb
|
@@ -297,14 +298,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
297
298
|
requirements:
|
298
299
|
- - ">="
|
299
300
|
- !ruby/object:Gem::Version
|
300
|
-
version: '
|
301
|
+
version: '3.0'
|
301
302
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
302
303
|
requirements:
|
303
304
|
- - ">="
|
304
305
|
- !ruby/object:Gem::Version
|
305
306
|
version: '0'
|
306
307
|
requirements: []
|
307
|
-
rubygems_version: 3.
|
308
|
+
rubygems_version: 3.2.33
|
308
309
|
signing_key:
|
309
310
|
specification_version: 4
|
310
311
|
summary: Rails sharding magic
|