database_consistency 2.0.0 → 2.0.1

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: 52986b5b93512eecd5adc0b4d37f873664a2ef35eea9b42359a0870f5ecf1c6d
4
- data.tar.gz: fa614ae4aa5e6f1b08fadd0d252e898745e1300aae1e5a65466727a80a41ec38
3
+ metadata.gz: ba84801df64868302240abb6b325652bc21c34086c2b4d32460bb092f55d7681
4
+ data.tar.gz: 49ba63ec3857648e90121ef8e7692fe217fcb41592b21087876628caa7888427
5
5
  SHA512:
6
- metadata.gz: 3d7309cf8351e0a7aac9009a4aac0d299a905f09a8d2238b629c880d9810d959f59ef3f5e0d8ce09e72a30d575c60cd792821acb3b2f51c09f023588a704f5a4
7
- data.tar.gz: 97cb23bf0541dbb7a95fdbbe78e836c5e9f8c52ae99fe25392c378a9b7acc22e9dd7d3020944aa97e17a1679c02a35bbacaf6067b29be5f3f65ce05bc6856c77
6
+ metadata.gz: f29ab6930f1317041b38879890a0195ed03d7620647a08baa5061fd82cd5b124587f0acafa9fe15b1d92747b4a8e7f05528fb4882b170cdf6feb23ed326547aa
7
+ data.tar.gz: a4e7fb560d24c41aa1dc02ad3127658ac9ab6f268be885843ca03cf24bc49e4354cec95f8d78a69ad44579eaef984a555c578e347eb98645de27248c75edfe3e
@@ -21,7 +21,8 @@ module DatabaseConsistency
21
21
  def preconditions
22
22
  supported? &&
23
23
  association.belongs_to? && !association.polymorphic? &&
24
- same_database?
24
+ same_database? &&
25
+ model.connection.table_exists?(model.table_name)
25
26
  rescue NameError
26
27
  false
27
28
  end
@@ -12,8 +12,9 @@ module DatabaseConsistency
12
12
 
13
13
  private
14
14
 
15
+ # column should be a boolean and table shouldn't be a view
15
16
  def preconditions
16
- column.type == :boolean
17
+ column.type == :boolean && model.connection.table_exists?(model.table_name)
17
18
  end
18
19
 
19
20
  def check
@@ -19,7 +19,7 @@ module DatabaseConsistency
19
19
  end
20
20
 
21
21
  def preconditions
22
- (regular_column || association) && validators.any?
22
+ (regular_column || association) && model.connection.table_exists?(model.table_name) && validators.any?
23
23
  end
24
24
 
25
25
  def report_template(status, column_name:, error_slug: nil)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1'
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: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-25 00:00:00.000000000 Z
11
+ date: 2024-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord