switchman 1.14.8 → 1.14.9
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: af371eaa6c622050b8e7db37afe53de773f420c9a4a0e17c51b2b85f6fa8a74c
|
4
|
+
data.tar.gz: b0002e538ef951ae7e90e1354190e6c38785844b9074254c9548579a20971f1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 335a626d0904a55dea7be067d553378c030196597cf387e3ef46037f7a26667705e2ed1b8ae54db0588ae395766d6567d9a8692ad15d16a2122e41c208adf82b
|
7
|
+
data.tar.gz: 9da1e76012054a5f9b9961f593cc326799740568e7135b08a3b8455ddf91a0e75c6a0a922660bc12c4f057dbc3d34a05b622737e5ac9281343cba488135eab0d
|
@@ -107,12 +107,12 @@ module Switchman
|
|
107
107
|
|
108
108
|
def save(*args)
|
109
109
|
@shard_set_in_stone = true
|
110
|
-
self.class.shard(shard, :implicit).scoping { super }
|
110
|
+
(self.class.current_scope || self.class.default_scoped).shard(shard, :implicit).scoping { super }
|
111
111
|
end
|
112
112
|
|
113
113
|
def save!(*args)
|
114
114
|
@shard_set_in_stone = true
|
115
|
-
self.class.shard(shard, :implicit).scoping { super }
|
115
|
+
(self.class.current_scope || self.class.default_scoped).shard(shard, :implicit).scoping { super }
|
116
116
|
end
|
117
117
|
|
118
118
|
def destroy
|
@@ -46,8 +46,15 @@ module Switchman
|
|
46
46
|
|
47
47
|
if ::Rails.version < '5.1'
|
48
48
|
::ActiveRecord::Base.configurations[::Rails.env] = spec.instance_variable_get(:@config).stringify_keys
|
49
|
-
|
49
|
+
elsif ::Rails.version < '6.0'
|
50
50
|
::ActiveRecord::Base.configurations[::Rails.env] = config.stringify_keys
|
51
|
+
else
|
52
|
+
# Adopted from the deprecated code that currently lives in rails proper
|
53
|
+
remaining_configs = ::ActiveRecord::Base.configurations.configurations.reject { |db_config| db_config.env_name == ::Rails.env }
|
54
|
+
new_config = ::ActiveRecord::DatabaseConfigurations.new(::Rails.env => config.stringify_keys).configurations
|
55
|
+
new_configs = remaining_configs + new_config
|
56
|
+
|
57
|
+
::ActiveRecord::Base.configurations = new_configs
|
51
58
|
end
|
52
59
|
else
|
53
60
|
# this is probably wrong now
|
data/lib/switchman/version.rb
CHANGED
data/lib/tasks/switchman.rake
CHANGED
@@ -72,7 +72,17 @@ module Switchman
|
|
72
72
|
shard = Shard.current
|
73
73
|
puts "#{shard.id}: #{shard.description}"
|
74
74
|
::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
|
75
|
-
::
|
75
|
+
if ::Rails.version < '6.0'
|
76
|
+
::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
|
77
|
+
else
|
78
|
+
# Adopted from the deprecated code that currently lives in rails proper
|
79
|
+
remaining_configs = ::ActiveRecord::Base.configurations.configurations.reject { |db_config| db_config.env_name == ::Rails.env }
|
80
|
+
new_config = ::ActiveRecord::DatabaseConfigurations.new(::Rails.env =>
|
81
|
+
::ActiveRecord::Base.connection_pool.spec.config.stringify_keys).configurations
|
82
|
+
new_configs = remaining_configs + new_config
|
83
|
+
|
84
|
+
::ActiveRecord::Base.configurations = new_configs
|
85
|
+
end
|
76
86
|
shard.database_server.unshackle do
|
77
87
|
old_actions.each { |action| action.call(*task_args) }
|
78
88
|
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: 1.14.
|
4
|
+
version: 1.14.9
|
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:
|
13
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|