database_consistency 1.1.0 → 1.1.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 538febddc734f33fc864270c7fcafda018dfae709ee0e462ccb63324054dd796
|
4
|
+
data.tar.gz: 4f8dd5fba8b01d8227b0a5b38a1148a3d29b6ef16712edb1b3d5a05bab2d7791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0ea2899794381c9e1c16b3ad10667aa5798aec73130e8abf6c5688829473de58facfbf15c68db5fb89509fa9d0a855a5828c044b2e4b501d465ef9f43300ad5
|
7
|
+
data.tar.gz: 7d0a59b4772578f7a2338df73de0c534020234e93ea620f48271328e5feaf7a8d7fada08ac9688ca8fe4c62c4bdf300f4689561e7108213b558346e8b9abc279
|
@@ -38,10 +38,14 @@ module DatabaseConsistency
|
|
38
38
|
model.connection.indexes(model.table_name).find do |another_index|
|
39
39
|
next if index.name == another_index.name
|
40
40
|
|
41
|
-
include_index_as_prefix?(another_index)
|
41
|
+
clause_equals?(another_index) && include_index_as_prefix?(another_index)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def clause_equals?(another_index)
|
46
|
+
another_index.where == index.where
|
47
|
+
end
|
48
|
+
|
45
49
|
def include_index_as_prefix?(another_index)
|
46
50
|
another_index_columns = Helper.extract_index_columns(another_index.columns)
|
47
51
|
index_columns == another_index_columns.first(index_columns.size)
|
@@ -38,10 +38,14 @@ module DatabaseConsistency
|
|
38
38
|
model.connection.indexes(model.table_name).find do |another_index|
|
39
39
|
next if index.name == another_index.name
|
40
40
|
|
41
|
-
another_index.unique && contain_index?(another_index)
|
41
|
+
another_index.unique && clause_equals?(another_index) && contain_index?(another_index)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def clause_equals?(another_index)
|
46
|
+
another_index.where == index.where
|
47
|
+
end
|
48
|
+
|
45
49
|
def contain_index?(another_index)
|
46
50
|
another_index_columns = Helper.extract_index_columns(another_index.columns)
|
47
51
|
index_columns & another_index_columns == another_index_columns
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_consistency
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Demin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|