active_record_proxy_adapters 0.10.2 → 0.11.0
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: e9709c38149a112c5203c15ed59fe97903484dcc7842c82e070c57d29fea21ed
|
|
4
|
+
data.tar.gz: f9054fc5ce575e3d0877a4aa3b3ba9cd59da532c4b30d85536e4f63318119aee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7fe2bf87693040205f3e1aa62cc48b783d830b618d65423a4a8c3bae1dc029aae526d00227f5ca7ed4542dba04832641a86b2344ab6036956d3b2d9d1fc90b6b
|
|
7
|
+
data.tar.gz: 26c32105d9ed2c6f6d49016224284077207f780d0d3e56e62a59e81441808b1c00109f52c0baf867b09dba1a33a7aab2e12e4bc54b59789ddf288f0802e615cd
|
|
@@ -17,9 +17,24 @@ module ActiveRecordProxyAdapters
|
|
|
17
17
|
connection.connection_class || ActiveRecord::Base
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# rubocop:disable Style/TrailingCommaInArrayLiteral
|
|
20
21
|
def hijackable_methods
|
|
21
|
-
|
|
22
|
+
[
|
|
23
|
+
# Create
|
|
24
|
+
:insert,
|
|
25
|
+
:exec_insert_all, # this one is an exception to the rule. there's no higher-level equivalent method to be called
|
|
26
|
+
# Retrieve
|
|
27
|
+
:select,
|
|
28
|
+
# Update
|
|
29
|
+
:update,
|
|
30
|
+
# Delete
|
|
31
|
+
:delete,
|
|
32
|
+
# Generic
|
|
33
|
+
:exec_query,
|
|
34
|
+
:execute,
|
|
35
|
+
]
|
|
22
36
|
end
|
|
37
|
+
# rubocop:enable Style/TrailingCommaInArrayLiteral
|
|
23
38
|
|
|
24
39
|
def active_record_v7?
|
|
25
40
|
active_record_version >= Gem::Version.new("7.2") && active_record_version < Gem::Version.new("8.0")
|
|
@@ -102,7 +102,8 @@ module ActiveRecordProxyAdapters
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
def coerce_query_to_string(sql_or_arel)
|
|
105
|
-
|
|
105
|
+
# TODO: implement custom Proxy arel parser
|
|
106
|
+
sql_or_arel.respond_to?(:to_sql) ? sql_or_arel.to_sql(connection_class) : sql_or_arel.to_s
|
|
106
107
|
end
|
|
107
108
|
|
|
108
109
|
def appropriate_connection(sql_string, &block)
|
|
@@ -173,7 +174,14 @@ module ActiveRecordProxyAdapters
|
|
|
173
174
|
|
|
174
175
|
result
|
|
175
176
|
ensure
|
|
176
|
-
|
|
177
|
+
# Check the connection back into its own pool, not whatever pool currently
|
|
178
|
+
# answers to the :reading role. In Rails system tests,
|
|
179
|
+
# ActiveRecord::TestFixtures#setup_shared_connection_pool reassigns the
|
|
180
|
+
# :reading role's pool_config on every transactional-fixture test's
|
|
181
|
+
# before_setup, so re-resolving `replica_pool` here can return a pool
|
|
182
|
+
# different from the one the connection was checked out of — which would
|
|
183
|
+
# check a replica adapter into the primary pool and poison it.
|
|
184
|
+
connection.pool.checkin(connection) if replica_connection?(connection)
|
|
177
185
|
end
|
|
178
186
|
|
|
179
187
|
def connected_to(role:, &block)
|