database_consistency 1.7.6 → 1.7.7
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: f17a39d98d4045434101b952706e15a54da6c1bc8a46860e7daa56932b9569a8
|
4
|
+
data.tar.gz: 73a0950925d6158c7e9be1dfa7e9d2c706bed88590884c7ab9784e3434e044e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd3677888dabe3342854f3ad10e2591cfb79027fd6f210099c4be014f21e02b3317dec9070a35b41876088fbae5bcd5d4faacdb452bbd6e98cfaf7808f3f3294
|
7
|
+
data.tar.gz: a1bdfe2c29b6a873bec6f9866eb11b9a2ac90fe4117df6586f9e3ab3687cb20f29f387b23a34b011f5f2c6a52e52ee881b8b3682ee2e527c1673e2249a4f74fa
|
data/lib/database_consistency/checkers/validators_fraction_checkers/column_presence_checker.rb
CHANGED
@@ -38,18 +38,25 @@ module DatabaseConsistency
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def check
|
41
|
-
|
41
|
+
if regular_column
|
42
|
+
analyse(attribute.to_s, type: :null_constraint_missing)
|
43
|
+
else
|
44
|
+
analyse_association
|
45
|
+
end
|
46
|
+
end
|
42
47
|
|
48
|
+
def analyse_association
|
43
49
|
reports = [analyse(association.foreign_key.to_s, type: :association_missing_null_constraint)]
|
44
50
|
if association.polymorphic?
|
45
51
|
reports << analyse(association.foreign_type.to_s, type: :association_foreign_type_missing_null_constraint)
|
46
52
|
end
|
47
|
-
|
48
|
-
reports
|
53
|
+
reports.compact.presence
|
49
54
|
end
|
50
55
|
|
51
56
|
def analyse(column_name, type:)
|
52
57
|
field = column(column_name)
|
58
|
+
# If the column is missing there is nothing we can do.
|
59
|
+
return if field.nil?
|
53
60
|
|
54
61
|
can_be_null = field.null
|
55
62
|
has_weak_option = weak_option?
|
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.
|
4
|
+
version: 1.7.7
|
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-
|
11
|
+
date: 2023-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|