database_consistency 1.7.20 → 1.7.21

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: 4b23b01d53d9091689967b91ddaf1439ec1397391646ce775bfa4ead5ca2142f
4
- data.tar.gz: fc0aa913897643ffb50aa5f8907606c2e592bd3c84ae407b1d9664bc425ae953
3
+ metadata.gz: 2565af47d96e1c040b197300b6952c0e8c110606f82a842296e50146de96e9eb
4
+ data.tar.gz: 879efffc98e6e937acbf15e742357d2a5570a19a95f3f43b9ec34ed4a042c5c7
5
5
  SHA512:
6
- metadata.gz: 7132db37d4d683daead886e87d915763e06a268a387bbaab01cf08ec4a518498644c2ad49ef271ce99976a591bfa31e5beb9067bbeec5faf352a0a03c9cd4ca6
7
- data.tar.gz: a57787aa6b06ffc4762e62b97e38f1fb92841b0e54ed5846e22a0179c5208982d1bd14a29b3a7a0d278944802b3af4c4d683c958842c5cdd9b908d94f653157d
6
+ metadata.gz: 6024ff7d235558f6b0ca703bddee252f4537e305df584ff37c1d8569e291b26e7838f31aa9817820d2ac686196e38ed420b5e2b42d608ad234d91003ebacabac
7
+ data.tar.gz: 0f5fe6203dbad2c91acbb99cdf4a82cb86cdbc0e5c13535942810f19a30c8b0d72b93392aa75f501b9bfa0b5965780ef798c3439fd19f0512099d0069f1de572
@@ -34,7 +34,23 @@ module DatabaseConsistency
34
34
  end
35
35
 
36
36
  def weak_option?
37
- validators.all? { |validator| validator.options.slice(*WEAK_OPTIONS).any? }
37
+ validators.all? do |validator|
38
+ result = validator.options.slice(*WEAK_OPTIONS).any?
39
+
40
+ result = false if required_with_if?(validator)
41
+
42
+ result
43
+ end
44
+ end
45
+
46
+ def belongs_to_required_validates_foreign_key_disabled?
47
+ ActiveRecord.version >= Gem::Version.new('7.1.0') &&
48
+ !ActiveRecord.belongs_to_required_validates_foreign_key
49
+ end
50
+
51
+ def required_with_if?(validator)
52
+ belongs_to_required_validates_foreign_key_disabled? &&
53
+ validator.options[:message] == :required && validator.options[:if].present?
38
54
  end
39
55
 
40
56
  def check
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.7.20'
4
+ VERSION = '1.7.21'
5
5
  end
@@ -81,7 +81,7 @@ require 'database_consistency/checkers/column_checkers/length_constraint_checker
81
81
  require 'database_consistency/checkers/column_checkers/primary_key_type_checker'
82
82
  require 'database_consistency/checkers/column_checkers/enum_value_checker'
83
83
  require 'database_consistency/checkers/column_checkers/three_state_boolean_checker'
84
- require 'database_consistency/checkers/column_checkers/implicit_ordering_checker.rb'
84
+ require 'database_consistency/checkers/column_checkers/implicit_ordering_checker'
85
85
 
86
86
  require 'database_consistency/checkers/validator_checkers/validator_checker'
87
87
  require 'database_consistency/checkers/validator_checkers/missing_unique_index_checker'
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.7.20
4
+ version: 1.7.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-22 00:00:00.000000000 Z
11
+ date: 2023-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord