pg_saurus 3.4.1 → 3.5.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b29ece12fe51ab68cec6a95570a9bd372aff0d2f
|
4
|
+
data.tar.gz: 0ba27c826028135791fcd45f8f742ea650cd3042
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ce85db15d409ee8ccac7fd7d3315a6bdbb6a721d6df1aff5df23a490d1d1a8bebf8383913b822dd7e724c57ddb424d699032baa723ece99e41078652248342a
|
7
|
+
data.tar.gz: ebbc2881e0153ecaea674d28a78aa6f59106a41059db4caf26748a092b7edcdb35324ed4ef8618ede82cbf30fd5b73f7cc31919f905edf37b7fb3260c7b967ef
|
@@ -27,6 +27,10 @@ module ActiveRecord
|
|
27
27
|
def add_index_with_concurrently(table_name, column_name, options = {})
|
28
28
|
creation_method = options.delete(:concurrently) ? 'CONCURRENTLY' : nil
|
29
29
|
|
30
|
+
# Whether to skip the quoting of columns. Used only for expressions like JSON indexes in which
|
31
|
+
# the column is difficult to target for quoting.
|
32
|
+
skip_column_quoting = options.delete(:skip_column_quoting) or false
|
33
|
+
|
30
34
|
index_name,
|
31
35
|
index_type,
|
32
36
|
index_columns,
|
@@ -59,7 +63,8 @@ module ActiveRecord
|
|
59
63
|
statements << "ON"
|
60
64
|
statements << quote_table_name(table_name)
|
61
65
|
statements << index_using if index_using.present?
|
62
|
-
statements << "(#{index_columns})" if index_columns.present?
|
66
|
+
statements << "(#{index_columns})" if index_columns.present? unless skip_column_quoting
|
67
|
+
statements << "(#{column_name})" if column_name.present? and skip_column_quoting
|
63
68
|
statements << index_options if index_options.present?
|
64
69
|
|
65
70
|
sql = statements.join(' ')
|
@@ -141,7 +146,7 @@ module ActiveRecord
|
|
141
146
|
else
|
142
147
|
quote_column_name(column_name)
|
143
148
|
end
|
144
|
-
|
149
|
+
|
145
150
|
result_name += " " + operator_name if operator_name
|
146
151
|
|
147
152
|
result_name
|
@@ -21,9 +21,11 @@ module ActiveRecord #:nodoc:
|
|
21
21
|
column_name
|
22
22
|
end
|
23
23
|
|
24
|
+
is_json_index = (columns.count == 1 && columns.first =~ /^(.+->.+)$/)
|
25
|
+
|
24
26
|
statement_parts = [
|
25
27
|
('add_index ' + index.table.inspect),
|
26
|
-
columns.inspect,
|
28
|
+
is_json_index ? "\"#{columns.first}\"" : columns.inspect,
|
27
29
|
(':name => ' + index.name.inspect),
|
28
30
|
]
|
29
31
|
statement_parts << ':unique => true' if index.unique
|
@@ -37,6 +39,8 @@ module ActiveRecord #:nodoc:
|
|
37
39
|
|
38
40
|
statement_parts << (':using => ' + index.access_method.inspect) unless index.access_method.downcase == 'btree'
|
39
41
|
|
42
|
+
statement_parts << ':skip_column_quoting => true' if is_json_index
|
43
|
+
|
40
44
|
' ' + statement_parts.join(', ')
|
41
45
|
end
|
42
46
|
|
data/lib/pg_saurus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_saurus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Potapov Sergey
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2019-
|
16
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: pg
|