switchman 1.13.2 → 1.13.3
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: ec8bd036f45f143718da9a25f56578e9d79217ce053df66eb828eafe5f2edd15
|
4
|
+
data.tar.gz: '0236808209e855742dc8caaf113176d6b6045db37c782c0e6eff69e8ae422370'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a97ccc3066a172dc3261008b7ceca6e25dc8d352cbaec9ea1e3db383ce7a0cd4fe188f74522e503e16e40c60709338953671e1e4e99c90a46d13079546abea3a
|
7
|
+
data.tar.gz: 62a28505e8c5fd3731de3d5ccf84b06d446b3adb9609f8cd5d14505b8cce9d9af608f44395ea6665ff6e8579facf22f7ceb6fbb3f5ec30a290dbdc8844efe75d
|
@@ -161,12 +161,13 @@ module Switchman
|
|
161
161
|
|
162
162
|
def quote_local_table_name(name)
|
163
163
|
# postgres quotes tables and columns the same; just pass through
|
164
|
-
# (differs from
|
165
|
-
# qualify the table)
|
164
|
+
# (differs from quote_table_name_with_shard below by no logic to
|
165
|
+
# explicitly qualify the table)
|
166
166
|
quote_column_name(name)
|
167
167
|
end
|
168
168
|
|
169
|
-
def quote_table_name
|
169
|
+
def quote_table_name(name)
|
170
|
+
return quote_local_table_name(name) if @use_local_table_name
|
170
171
|
name = ::ActiveRecord::ConnectionAdapters::PostgreSQL::Utils.extract_schema_qualified_name(name.to_s)
|
171
172
|
if !name.schema && use_qualified_names?
|
172
173
|
name.instance_variable_set(:@schema, shard.name)
|
@@ -174,6 +175,13 @@ module Switchman
|
|
174
175
|
name.quoted
|
175
176
|
end
|
176
177
|
|
178
|
+
def with_local_table_name
|
179
|
+
@use_local_table_name = true
|
180
|
+
yield
|
181
|
+
ensure
|
182
|
+
@use_local_table_name = false
|
183
|
+
end
|
184
|
+
|
177
185
|
def foreign_keys(table_name)
|
178
186
|
schema = shard.name if use_qualified_names?
|
179
187
|
|
@@ -224,19 +224,7 @@ module Switchman
|
|
224
224
|
end
|
225
225
|
|
226
226
|
def arel_columns(columns)
|
227
|
-
|
228
|
-
if (Symbol === field || String === field) && (klass.has_attribute?(field) || klass.attribute_alias?(field)) && !from_clause.value
|
229
|
-
klass.arel_attribute(field, table)
|
230
|
-
elsif Symbol === field
|
231
|
-
# the rest of this is pulled from AR - the only change is from quote_table_name to quote_column_name here
|
232
|
-
# otherwise qualified names will add the schema to a column
|
233
|
-
connection.quote_column_name(field.to_s)
|
234
|
-
elsif Proc === field
|
235
|
-
field.call
|
236
|
-
else
|
237
|
-
field
|
238
|
-
end
|
239
|
-
end
|
227
|
+
connection.with_local_table_name { super }
|
240
228
|
end
|
241
229
|
|
242
230
|
# semi-private
|
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: 1.13.
|
4
|
+
version: 1.13.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: 2019-
|
13
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|