database_consistency 0.8.5 → 0.8.6

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: ed9a2103f6e588628f52a00ddd933b0dc899fac0d6e8752a3bf1111a3894fb17
4
- data.tar.gz: d8bf6a551c55fc3e4a33d837354f1b3d777c6171b48aa84d2cce5bbba478e0d5
3
+ metadata.gz: e4c8440238a874ddd2ae11563b8b034c64f94e467426ef85afcd8befdf9a55c2
4
+ data.tar.gz: 7e7275bf7029cf03a0a9d3e35975d1a927a7317d323c2c7db00eb22306f67aca
5
5
  SHA512:
6
- metadata.gz: a1c59e4de257fdaa7aae63725abcc82f7da1f4ea98f51fc804162b8c5488021c3c665f7e7298b135eaddd50560415b563f0cd608fdaaee81519e44af74966bb2
7
- data.tar.gz: 516f5102afb3234eb88d8a8039b584c9210b33d78401290423032cbd017df5218aa6a455ae5faeffb54dd9bad7ea82a17a40f1729255c7ea2ed988924bad3ea9
6
+ metadata.gz: dcd5d6ee89a07990da47ad72231aa5884ee8209f071f21a4ab9ae3521f5ae2bd85167b2b31d32052bff081cd240f5965b4eef3f814ab8ce1ee83ab480d9ccaff
7
+ data.tar.gz: 2ff692d1618d7ef53500ccf3f88bb361c856d62ea7f577ce66a1c18122af0f05c1c55d5023b3313c4a17f55dbd20d14a0193d6116575e1b551651ad5549829ff
@@ -17,8 +17,12 @@ module DatabaseConsistency
17
17
 
18
18
  private
19
19
 
20
+ # We skip check when:
21
+ # - association is polymorphic association
22
+ # - association has `through` option
23
+ # - associated class doesn't exist
20
24
  def preconditions
21
- !association.polymorphic? && association.klass.present?
25
+ !association.polymorphic? && association.through_reflection.nil? && association.klass.present?
22
26
  rescue NameError
23
27
  false
24
28
  end
@@ -75,7 +79,7 @@ module DatabaseConsistency
75
79
  #
76
80
  # @return [ActiveRecord::ConnectionAdapters::Column]
77
81
  def column(model, column_name)
78
- model.connection.columns(model.table_name).find { |column| column.name == column_name }
82
+ model.connection.columns(model.table_name).find { |column| column.name == column_name.to_s }
79
83
  end
80
84
 
81
85
  # @param [ActiveRecord::ConnectionAdapters::Column] column
@@ -92,11 +96,6 @@ module DatabaseConsistency
92
96
  database_factory.type(type(column)).convert
93
97
  end
94
98
 
95
- # @return [Boolean]
96
- def supported_type?(column)
97
- database_factory.type(type(column)).supported?
98
- end
99
-
100
99
  # @return [Boolean]
101
100
  def belongs_to_association?
102
101
  association.macro == :belongs_to
@@ -14,7 +14,7 @@ module DatabaseConsistency
14
14
 
15
15
  # @return [String]
16
16
  def convert
17
- TYPES[type]
17
+ TYPES[type] || type
18
18
  end
19
19
  end
20
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '0.8.5'
4
+ VERSION = '0.8.6'
5
5
  end
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.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2020-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord