database_consistency 3.0.8 → 3.0.10
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32133531a7355c667f1c2d9011aab601a3753627f0a4b9f58fc206d08fc4f547
|
|
4
|
+
data.tar.gz: 4d0116c74266aa52363048c4cd4bc48f3d948fb08977b558028a394cd2391645
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0804288ed363357442a702395d6cfa5e498d6e8b8ec5a74bb24a6ec1d8b0ae7f9c65cbe5d96e7906f7d886363f58ed4f15b2a46e248b6e32f4921a1a8fbd5f98'
|
|
7
|
+
data.tar.gz: b6ea53a21f6b21120d291c73edab77f26f3a827c853b6d415a63d1dbe13974dce4b63703caaded4d3098fee8cc76866f4befd6cecfebc45cb80dc837d25adeee
|
|
@@ -11,11 +11,25 @@ module DatabaseConsistency
|
|
|
11
11
|
].freeze
|
|
12
12
|
PLAIN_IDENTIFIER_PATTERN =
|
|
13
13
|
/\b([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)?)\b(?!\s*\()/.freeze
|
|
14
|
+
# Without one of these options, `numericality` only asserts "is a number",
|
|
15
|
+
# which the column's numeric type already guarantees. There is no
|
|
16
|
+
# corresponding CHECK constraint to look for in that case, so validators
|
|
17
|
+
# with none of these options are skipped.
|
|
18
|
+
# Listed explicitly rather than excluding the known non-range options
|
|
19
|
+
# (`only_integer`, `allow_nil`, ...) so that an unrecognized option never
|
|
20
|
+
# makes us demand a constraint that cannot exist. The tradeoff is that a
|
|
21
|
+
# future range option must be added here to be reported on.
|
|
22
|
+
RANGE_OPTIONS = %i[
|
|
23
|
+
greater_than greater_than_or_equal_to
|
|
24
|
+
less_than less_than_or_equal_to
|
|
25
|
+
equal_to other_than in
|
|
26
|
+
].freeze
|
|
14
27
|
|
|
15
28
|
private
|
|
16
29
|
|
|
17
30
|
def filter(validator)
|
|
18
|
-
validator.kind == :numericality
|
|
31
|
+
validator.kind == :numericality &&
|
|
32
|
+
validator.options.slice(*RANGE_OPTIONS).any?
|
|
19
33
|
end
|
|
20
34
|
|
|
21
35
|
def preconditions
|
|
@@ -58,9 +72,12 @@ module DatabaseConsistency
|
|
|
58
72
|
.flatten
|
|
59
73
|
.map { |identifier| identifier.split('.').last }
|
|
60
74
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
# Keywords are only stripped from plain identifiers. A quoted identifier is
|
|
76
|
+
# always a column, even when it spells a reserved word, so filtering those
|
|
77
|
+
# would hide constraints on columns such as `"limit"` or `"order"`.
|
|
78
|
+
plain_columns = plain_identifiers.reject { |identifier| SQL_KEYWORDS.include?(identifier.downcase) }
|
|
79
|
+
|
|
80
|
+
(quoted_identifiers + plain_columns).map(&:downcase)
|
|
64
81
|
end
|
|
65
82
|
|
|
66
83
|
def column
|
|
@@ -58,7 +58,7 @@ module DatabaseConsistency
|
|
|
58
58
|
def database_enabled?(name)
|
|
59
59
|
value = configuration.dig('DatabaseConsistencyDatabases', name, 'enabled')
|
|
60
60
|
|
|
61
|
-
value.nil? ? true : value
|
|
61
|
+
value.nil? ? true : value # rubocop:disable Style/RedundantCondition -- value may be `false`, `||` would be wrong
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
private
|
|
@@ -93,7 +93,7 @@ module DatabaseConsistency
|
|
|
93
93
|
def global_enabling
|
|
94
94
|
value = configuration.dig('DatabaseConsistencyCheckers', 'All', 'enabled')
|
|
95
95
|
|
|
96
|
-
value.nil? ? true : value
|
|
96
|
+
value.nil? ? true : value # rubocop:disable Style/RedundantCondition -- value may be `false`, `||` would be wrong
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
def load_yaml_config_file(filepath)
|
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: 3.0.
|
|
4
|
+
version: 3.0.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Evgeniy Demin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-08-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -112,14 +112,14 @@ dependencies:
|
|
|
112
112
|
name: rubocop
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- - "
|
|
115
|
+
- - ">="
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
117
|
version: '0.55'
|
|
118
118
|
type: :development
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
|
-
- - "
|
|
122
|
+
- - ">="
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: '0.55'
|
|
125
125
|
- !ruby/object:Gem::Dependency
|