switchman 3.3.5 → 3.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/switchman/database_server.rb +20 -5
- data/lib/switchman/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0e25e9a338b74ed4340f605d27978bba42bd45ef47ddac2bf7c44047db8a014
|
4
|
+
data.tar.gz: a6f6cdb8f1686213391d38f1eb172fefa9346012f3ce055b152696f1dcd05975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe38ed259e6d881d9f60ecd0dd96b65a3dd154b750beb3b5ee5b8af03e7683f056238feb464fc32c5156841b439200c6ff0c9bf5959dc108b5bb91c298bd450a
|
7
|
+
data.tar.gz: b74decf8b11511749f80ffc792b2a98dbf6cdf36670d1f2db84a80975138aee8f0f4c11dab8883b9be93413324fb7f574589d6788781cd8e664dea34fe964cbd
|
@@ -221,12 +221,12 @@ module Switchman
|
|
221
221
|
|
222
222
|
unless schema == false
|
223
223
|
shard.activate do
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
224
|
+
with_empty_caches do
|
225
|
+
::ActiveRecord::Base.connection.transaction(requires_new: true) do
|
226
|
+
::ActiveRecord::Base.connection.migration_context.migrate
|
227
|
+
end
|
228
228
|
end
|
229
|
-
|
229
|
+
|
230
230
|
::ActiveRecord::Base.descendants.reject do |m|
|
231
231
|
m <= UnshardedRecord || !m.table_exists?
|
232
232
|
end.each(&:define_attribute_methods)
|
@@ -278,5 +278,20 @@ module Switchman
|
|
278
278
|
def reset_column_information
|
279
279
|
::ActiveRecord::Base.descendants.reject { |m| m <= UnshardedRecord }.each(&:reset_column_information)
|
280
280
|
end
|
281
|
+
|
282
|
+
def with_empty_caches
|
283
|
+
connection = ::ActiveRecord::Base.connection
|
284
|
+
connection_pool = ::ActiveRecord::Base.connection_pool
|
285
|
+
previous_schema_cache = connection_pool.get_schema_cache(connection)
|
286
|
+
temporary_schema_cache = ::ActiveRecord::ConnectionAdapters::SchemaCache.new(connection)
|
287
|
+
|
288
|
+
reset_column_information
|
289
|
+
connection_pool.set_schema_cache(temporary_schema_cache)
|
290
|
+
|
291
|
+
yield
|
292
|
+
|
293
|
+
connection_pool.set_schema_cache(previous_schema_cache)
|
294
|
+
reset_column_information
|
295
|
+
end
|
281
296
|
end
|
282
297
|
end
|
data/lib/switchman/version.rb
CHANGED