database_consistency 1.1.11 → 1.1.12
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 908211c725197dadbe72f2f7c8f2f47d48a55ed546c57d2f512b9b2978fb325a
|
4
|
+
data.tar.gz: 4b18e433573c598b25906dce98554516f3c54bacbd897b59c8f72c6d9577a53d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43ea449cc58c970f99deb81936461d2f267a107934ad93cfb1f73ef0e0a8e46c97d9ba5085a54538828d162ca06638ad35afb907fa51de661df30bad9527cefc
|
7
|
+
data.tar.gz: 799f1975507dababf597ca140655377e90a1480af4422080349027b03ef7ef9dbade4125e95f317ef3d873706e82f1c24991c9c9600a08cb3dca3e6ff2bbc8e0
|
@@ -9,10 +9,17 @@ module DatabaseConsistency
|
|
9
9
|
private
|
10
10
|
|
11
11
|
# We skip check when:
|
12
|
+
# - underlying models belong to different databases
|
12
13
|
# - association isn't belongs_to association
|
13
14
|
# - association is polymorphic
|
14
15
|
def preconditions
|
15
|
-
supported? &&
|
16
|
+
supported? &&
|
17
|
+
association.belongs_to? && !association.polymorphic? &&
|
18
|
+
same_database?
|
19
|
+
end
|
20
|
+
|
21
|
+
def same_database?
|
22
|
+
Helper.connection_config(model) == Helper.connection_config(association.klass)
|
16
23
|
end
|
17
24
|
|
18
25
|
def supported?
|
@@ -13,6 +13,14 @@ module DatabaseConsistency
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
def connection_config(klass)
|
17
|
+
if klass.respond_to?(:connection_config)
|
18
|
+
klass.connection_config
|
19
|
+
else
|
20
|
+
klass.connection_db_config.configuration_hash
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
16
24
|
# Returns list of models to check
|
17
25
|
def models
|
18
26
|
ActiveRecord::Base.descendants.delete_if(&:abstract_class?).delete_if do |klass|
|
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.1.
|
4
|
+
version: 1.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Demin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|