database_consistency 0.8.2 → 0.8.3

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: 96d59f04ee02179f11d92477feb260aaa444c9b923ecbc142aa2b69ca12b3808
4
- data.tar.gz: 6c79bf6d628c470a45976047ffcc608bddf07ff610f802a04542462b36ae4421
3
+ metadata.gz: 5015849cbfceb5d46a68ab0c3f9ba0e620fffbf013c16af563d3aa8fd16b140f
4
+ data.tar.gz: dd379822c590457db98fd9f23fe99f19868063cf994e804eec11fe61b7311105
5
5
  SHA512:
6
- metadata.gz: 2c563868a70b3dd6cd1fe7d3f62481e6dee156c75a42a22f7e6ee43ce41d5ad08d6742d099c0a145a2b331726282ec2a71234ab1194361af655f18120e9c1b48
7
- data.tar.gz: 4ccdf6f7647b4aac78a7378a15d7796f5ed35997f7f59ec77176ebbc55019faf3a0581852e52d529d7c11aa8d8f59a495295445ed39e0a81a2ec0b6a41f638e5
6
+ metadata.gz: 3ec317d549f0852e6396db14f7263904448a3dda2c2515f83a174946a9d8138163f909b078a235a41c5d36daa01bbc38cd61c03f23921d3ad8704c7742e7fcec
7
+ data.tar.gz: 8c41bdf53040283417a3d616e9cf9b13a34138ba17edf65b84df1506e630e758d88995a618ea2b111a8d45884c49bf8b4e5f9b2c38e16fbfdd379328260aa0f1
@@ -48,7 +48,13 @@ module DatabaseConsistency
48
48
  end
49
49
 
50
50
  def index_columns
51
- @index_columns ||= ([wrapped_attribute_name] + Array.wrap(validator.options[:scope])).map(&:to_s)
51
+ @index_columns ||= ([wrapped_attribute_name] + scope_columns).map(&:to_s)
52
+ end
53
+
54
+ def scope_columns
55
+ @scope_columns ||= Array.wrap(validator.options[:scope]).map do |scope_item|
56
+ model._reflect_on_association(scope_item)&.foreign_key || scope_item
57
+ end
52
58
  end
53
59
 
54
60
  def sorted_index_columns
@@ -4,7 +4,7 @@ module DatabaseConsistency
4
4
  module Checkers
5
5
  # This class checks if presence validator has non-null constraint in the database
6
6
  class ColumnPresenceChecker < ValidatorsFractionChecker
7
- WEAK_OPTIONS = %i[allow_nil allow_blank if unless].freeze
7
+ WEAK_OPTIONS = %i[allow_nil allow_blank if unless on].freeze
8
8
  # Message templates
9
9
  CONSTRAINT_MISSING = 'column should be required in the database'
10
10
  POSSIBLE_NULL = 'column is required but there is possible null value insert'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '0.8.2'
4
+ VERSION = '0.8.3'
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: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-20 00:00:00.000000000 Z
11
+ date: 2020-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord