database_consistency 1.7.18 → 1.7.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/database_consistency/helper.rb +8 -1
- 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: 4b23b01d53d9091689967b91ddaf1439ec1397391646ce775bfa4ead5ca2142f
|
4
|
+
data.tar.gz: fc0aa913897643ffb50aa5f8907606c2e592bd3c84ae407b1d9664bc425ae953
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7132db37d4d683daead886e87d915763e06a268a387bbaab01cf08ec4a518498644c2ad49ef271ce99976a591bfa31e5beb9067bbeec5faf352a0a03c9cd4ca6
|
7
|
+
data.tar.gz: a57787aa6b06ffc4762e62b97e38f1fb92841b0e54ed5846e22a0179c5208982d1bd14a29b3a7a0d278944802b3af4c4d683c958842c5cdd9b908d94f653157d
|
@@ -31,7 +31,7 @@ module DatabaseConsistency
|
|
31
31
|
|
32
32
|
def project_models
|
33
33
|
ActiveRecord::Base.descendants.select do |klass|
|
34
|
-
project_klass?(klass)
|
34
|
+
project_klass?(klass) && connected?(klass)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -44,6 +44,13 @@ module DatabaseConsistency
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def connected?(klass)
|
48
|
+
klass.connection
|
49
|
+
rescue ActiveRecord::ConnectionNotEstablished
|
50
|
+
puts "#{klass} doesn't have active connection: ignoring"
|
51
|
+
false
|
52
|
+
end
|
53
|
+
|
47
54
|
# Return list of not inherited models
|
48
55
|
def parent_models
|
49
56
|
models.group_by(&:table_name).each_value.flat_map do |models|
|
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.20
|
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-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|