switchman 3.6.1 → 3.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30e02a7b02e23693a5bab2272c0d51d452ca8f22aac18bf869c68280a002a333
4
- data.tar.gz: c6e252c1c8fae37d78d801f446ebb6ddeb83c82b89690eda4bff7f8157e93c07
3
+ metadata.gz: 8a34057337ce5a3a1ded4a6964c52d777c561b44af92c15bb50d3f4a83f92cdc
4
+ data.tar.gz: d4c840584fa965c7e46ac378a17135e024f99c7e9ee30f1448a75e83721860ad
5
5
  SHA512:
6
- metadata.gz: 2ad549fbd26947a8ae1fc61e966741d1541b767429be8f4c3c57b1955390bbab2481629e88450ad31ea6d8ae219801713740841c70a07283028c7ccbcfd60caf
7
- data.tar.gz: 9f2481438cdc6d232e758174f405aeb641c1d02467172679cd2cb72ea4cd18569c0a00c626e9514de4dadd76cca2cc7c72dd80e28287e60e9bdd2c2632360021
6
+ metadata.gz: 3dc282c71808ca9bbac544773d8025d0e46fa0777de110f5c1b6957622022fdf43e7d5b148abc07b6176b5043008af85dc49bd58ca2e4a6960a42954bbddf49b
7
+ data.tar.gz: 7455c67b0d20e635295f5ce3f6d839019f00bae14d2f03ded1e0a0572c22e270e6793bd113f0fc9644621e5c62ae6c7ae546ec92deadc1d7a7b8d363cb34bef1
@@ -153,8 +153,8 @@ module Switchman
153
153
 
154
154
  def self.prepended(klass)
155
155
  klass.singleton_class.prepend(ClassMethods)
156
- klass.scope :non_shadow, ->(key = primary_key) { where("#{key}<=? AND #{key}>?", Shard::IDS_PER_SHARD, 0) }
157
- klass.scope :shadow, ->(key = primary_key) { where("#{key}>?", Shard::IDS_PER_SHARD) }
156
+ klass.scope :non_shadow, ->(key = primary_key) { where(key => 0..Shard::IDS_PER_SHARD) }
157
+ klass.scope :shadow, ->(key = primary_key) { where(key => Shard::IDS_PER_SHARD..) }
158
158
  end
159
159
 
160
160
  def _run_initialize_callbacks
@@ -3,8 +3,14 @@
3
3
  module Switchman
4
4
  module ActiveRecord
5
5
  module PendingMigrationConnection
6
- def self.current_switchman_shard
7
- ::ActiveRecord::Base.current_switchman_shard
6
+ module ClassMethods
7
+ def current_role
8
+ ::ActiveRecord::Base.current_role
9
+ end
10
+
11
+ def current_switchman_shard
12
+ ::ActiveRecord::Base.current_switchman_shard
13
+ end
8
14
  end
9
15
  end
10
16
  end
@@ -50,8 +50,8 @@ module Switchman
50
50
  end
51
51
  end
52
52
 
53
- def explain
54
- activate { |relation| relation.call_super(:explain, Relation) }
53
+ def explain(*args)
54
+ activate { |relation| relation.call_super(:explain, Relation, *args) }
55
55
  end
56
56
 
57
57
  def load(&block)
@@ -79,7 +79,8 @@ module Switchman
79
79
  ::ActiveRecord::Migrator.prepend(ActiveRecord::Migrator)
80
80
 
81
81
  if ::Rails.version > "7.1.3"
82
- ::ActiveRecord::PendingMigrationConnection.include(ActiveRecord::PendingMigrationConnection)
82
+ ::ActiveRecord::PendingMigrationConnection.singleton_class
83
+ .include(ActiveRecord::PendingMigrationConnection::ClassMethods)
83
84
  end
84
85
 
85
86
  ::ActiveRecord::Reflection::AbstractReflection.include(ActiveRecord::Reflection::AbstractReflection)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = "3.6.1"
4
+ VERSION = "3.6.3"
5
5
  end
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.6.1
4
+ version: 3.6.3
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-03-21 00:00:00.000000000 Z
13
+ date: 2024-04-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord