db_schema 0.1.2 → 0.1.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 +4 -4
- data/README.md +1 -1
- data/lib/db_schema/reader.rb +16 -10
- data/lib/db_schema/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f262094701b7ff8ff410c8854af2676daff44f4f
|
4
|
+
data.tar.gz: 0ba850facc23b85c344314a7e1e8b567ac762e4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fb1c3a34728124816899da8c6f67d82d70a38a0f40228cb65fca5597db8db9984fa5490554c64f0484e4160f33da94220fc385cc4b78298c6103aad189b9a6e
|
7
|
+
data.tar.gz: daeb82268ecfa4202dee52f97d92c8f4e2c6cd01a0af5c24ebb8391f16128836137a8914b8ed752eef3a4d07a478853dc75a1315358e2bc2b51df447e9d451a1
|
data/README.md
CHANGED
data/lib/db_schema/reader.rb
CHANGED
@@ -190,22 +190,28 @@ SELECT extname
|
|
190
190
|
|
191
191
|
private
|
192
192
|
def index_expressions_data(indices_data)
|
193
|
-
|
194
|
-
expressions_count = index_data[:column_positions].split(' ').count('0')
|
193
|
+
all_positions, max_position = {}, 0
|
195
194
|
|
196
|
-
|
197
|
-
|
198
|
-
|
195
|
+
indices_data.each do |index_data|
|
196
|
+
positions = index_data[:column_positions].split(' ').map(&:to_i)
|
197
|
+
expression_positions = positions.each_index.select { |i| positions[i].zero? }
|
198
|
+
|
199
|
+
if expression_positions.any?
|
200
|
+
all_positions[index_data[:index_oid]] = expression_positions
|
201
|
+
max_position = [max_position, expression_positions.max].max
|
199
202
|
end
|
200
203
|
end
|
201
204
|
|
202
|
-
if
|
205
|
+
if all_positions.any?
|
203
206
|
DbSchema.connection[
|
204
207
|
EXPRESSION_INDICES_QUERY,
|
205
|
-
Sequel.pg_array(
|
206
|
-
Sequel.pg_array((1..
|
207
|
-
].each_with_object({}) do |index_data,
|
208
|
-
|
208
|
+
Sequel.pg_array(all_positions.keys),
|
209
|
+
Sequel.pg_array((1..max_position.succ).to_a)
|
210
|
+
].each_with_object({}) do |index_data, indexes_data|
|
211
|
+
index_id = index_data[:index_id]
|
212
|
+
expressions = all_positions[index_id].map { |pos| index_data[:definitions][pos] }
|
213
|
+
|
214
|
+
indexes_data[index_id] = expressions
|
209
215
|
end
|
210
216
|
else
|
211
217
|
{}
|
data/lib/db_schema/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vsevolod Romashov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|