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: f37408420931f459ea476d095f441e40256ea2279e07c21ad9d477c0781d5944
4
- data.tar.gz: b054877a7819333fab57dbe22786456d4a0328b462f9808561e470290b3ae6e7
3
+ metadata.gz: 538febddc734f33fc864270c7fcafda018dfae709ee0e462ccb63324054dd796
4
+ data.tar.gz: 4f8dd5fba8b01d8227b0a5b38a1148a3d29b6ef16712edb1b3d5a05bab2d7791
5
5
  SHA512:
6
- metadata.gz: c2e7a18dabde150f3f1f2ee144b6076e2c0fb944c9c128851379e86007f0aed056f1fb550cc19319b777767ffc165534939a680e248213473032054dfa8e2924
7
- data.tar.gz: f047ff2a3e5e41137a93f5c64e4a0288e74b0d687670e7eabe5b3656a675abf87df75586fd5a0988f25f26f993d20542addfd2d84b430dac7dd30025f2016415
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
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.0
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-24 00:00:00.000000000 Z
11
+ date: 2021-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord