database_consistency 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/database_consistency +2 -2
- data/lib/database_consistency.rb +1 -1
- data/lib/database_consistency/checkers/association_checkers/missing_index_checker.rb +4 -1
- data/lib/database_consistency/rescue_error.rb +5 -2
- data/lib/database_consistency/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f35fd47d191dad146fc189990674ed806ea0a024011b41ef83e9fbe61a031ecc
|
4
|
+
data.tar.gz: 46b44a37b9e4d4b13ceb17b16929ae8e7c8a11a360c6cb5adc7385859600ae21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f2eab4d81e85c90c88368d46122cf83b0a823af849fa5ebf68e419173e43cbc0dc4420bc219e745263b78c1e304d361fa44522f6bdad9913057979ec393822a
|
7
|
+
data.tar.gz: 260fbd40013cbab95bce38847badad9a1f3cde38e1afd69d58dba7ce1e7f03dee4bb21dc75249401dbf27f966efbce28a41a2307f65aac312f4635225846054d
|
data/bin/database_consistency
CHANGED
data/lib/database_consistency.rb
CHANGED
@@ -12,11 +12,14 @@ module DatabaseConsistency
|
|
12
12
|
# We skip check when:
|
13
13
|
# - association isn't a `HasOne` or `HasMany`
|
14
14
|
# - association has `through` option
|
15
|
+
# - associated class doesn't exist
|
15
16
|
def preconditions
|
16
17
|
%i[
|
17
18
|
has_one
|
18
19
|
has_many
|
19
|
-
].include?(association.macro) && association.through_reflection.nil?
|
20
|
+
].include?(association.macro) && association.through_reflection.nil? && association.klass
|
21
|
+
rescue NameError
|
22
|
+
false
|
20
23
|
end
|
21
24
|
|
22
25
|
# Table of possible statuses
|
@@ -3,8 +3,6 @@
|
|
3
3
|
module DatabaseConsistency
|
4
4
|
# The class writes error to the file
|
5
5
|
class RescueError
|
6
|
-
attr_reader :error
|
7
|
-
|
8
6
|
private_class_method :new
|
9
7
|
|
10
8
|
def self.call(error)
|
@@ -12,6 +10,11 @@ module DatabaseConsistency
|
|
12
10
|
@singleton.call(error)
|
13
11
|
end
|
14
12
|
|
13
|
+
# @return [Boolean]
|
14
|
+
def self.empty?
|
15
|
+
@singleton.nil?
|
16
|
+
end
|
17
|
+
|
15
18
|
def initialize
|
16
19
|
puts 'Hey, some of checks fail with an error, please open an issue on github at https://github.com/djezzzl/database_consistency.'
|
17
20
|
puts "Attach the created file: #{filename}"
|
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.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Demin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|