table_inspector 0.3.0 → 0.3.1
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/lib/table_inspector/indexes.rb +12 -12
- data/lib/table_inspector/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: 42d6919ba568fa3f00f338fc84c7d526de66932b17693f72fea8fd0ab8497961
|
4
|
+
data.tar.gz: 82978c52fac51ee0943ed41a2d4105079fb536fd69c66fc0bf52a1d2c95fb226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bd23700289b479051fd88f701721e0cffab48b33ebca2a80e043007e8020e78f0db3a05c19405a1b7c2c7656ab526f618b31522b94231670fa87a16700c404d
|
7
|
+
data.tar.gz: 4a81daad914ffff7eac4853761044c408d49cbd5f4e2ea9f38a2c3ec2ef355b8024b1fc770bdff3124465ec7359a6a2e9db9ebd410fa594cba2d520839eebcdf
|
@@ -12,7 +12,7 @@ module TableInspector
|
|
12
12
|
render_title
|
13
13
|
|
14
14
|
if column
|
15
|
-
|
15
|
+
render_indexes_with_specific_column
|
16
16
|
else
|
17
17
|
render_indexes
|
18
18
|
end
|
@@ -26,7 +26,7 @@ module TableInspector
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def render_indexes_with_specific_column
|
30
30
|
if indexes_with_specific_column.blank?
|
31
31
|
puts "Empty."
|
32
32
|
return
|
@@ -34,11 +34,7 @@ module TableInspector
|
|
34
34
|
|
35
35
|
Grid.new.render do |grid|
|
36
36
|
indexes_with_specific_column.each do |index|
|
37
|
-
grid <<
|
38
|
-
index.name,
|
39
|
-
"[#{index.columns.join(', ')}]",
|
40
|
-
index.unique ? "UNIQUE" : ""
|
41
|
-
]
|
37
|
+
grid << compose_index_data(index)
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
@@ -51,15 +47,19 @@ module TableInspector
|
|
51
47
|
|
52
48
|
Grid.new.render do |grid|
|
53
49
|
indexes.each do |index|
|
54
|
-
grid <<
|
55
|
-
index.name,
|
56
|
-
"[#{index.columns.join(', ')}]",
|
57
|
-
index.unique ? "UNIQUE" : ""
|
58
|
-
]
|
50
|
+
grid << compose_index_data(index)
|
59
51
|
end
|
60
52
|
end
|
61
53
|
end
|
62
54
|
|
55
|
+
def compose_index_data(index)
|
56
|
+
[
|
57
|
+
index.name,
|
58
|
+
"[#{index.columns.join(', ')}]",
|
59
|
+
index.unique ? "UNIQUE" : ""
|
60
|
+
]
|
61
|
+
end
|
62
|
+
|
63
63
|
def indexes
|
64
64
|
@indexes ||= connection.indexes(klass.table_name)
|
65
65
|
end
|