database_consistency 1.7.11 → 1.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf8618ba8f3e8311f6cfe28281eb840f72fb389267d23c7df8dacceb81466856
4
- data.tar.gz: 14b60dbacd605899a0f1e5c95147b1f879d36ff70bcf761f867412697093d552
3
+ metadata.gz: 8560e4cc5588b8182f8d5258703894839190a758abf57e35e2abe81a630848fc
4
+ data.tar.gz: 26b96205cd47d48f9a557d6986ef2d2f0eef940f1407ed430760f6201c91cca5
5
5
  SHA512:
6
- metadata.gz: 368509ce28357a3817a1f8c05233db99b9baa451b70e28fc484d2ea87e1745de08a65c0aff88dfc71d730b8fcd5932565b685b97d1a32b224faf9f494413055c
7
- data.tar.gz: d8f1272dfabd6d7531efe1d37fd13924bedf734bf4def4274c24c8bc0d85e616a6b2c391e8594f32051e3a5cba15cb19d3aab2c6a8b682d48b1d928f21c95c00
6
+ metadata.gz: bfb1870b761338b23481926ec64cea7a814b7a174937d5035ca6a71ef63f7cfd332db6ab243f15ff5e9990a6445522b5565d2103b0c45eeb147f22eddbc48d7f
7
+ data.tar.gz: feec3a2004be04efe8ab1329a79b4b4395ffa3feec5c7798ad04b8218b7365b917a89a80681409d9a1827a5620105a7295ff6b67863828dd85b555c1dc8e7e7f
@@ -9,7 +9,11 @@ module DatabaseConsistency
9
9
 
10
10
  def initialize(file_paths = DEFAULT_PATH)
11
11
  @configuration = existing_configurations(file_paths).then do |existing_paths|
12
- puts "Loaded configurations: #{existing_paths.join(', ')}"
12
+ if existing_paths.any?
13
+ puts "Loaded configurations: #{existing_paths.join(', ')}"
14
+ else
15
+ puts 'No configurations were provided'
16
+ end
13
17
  extract_configurations(existing_paths)
14
18
  end
15
19
  end
@@ -13,6 +13,10 @@ module DatabaseConsistency
13
13
  end
14
14
  end
15
15
 
16
+ def database_name(model)
17
+ model.connection_db_config.name.to_s if model.respond_to?(:connection_db_config)
18
+ end
19
+
16
20
  def postgresql?
17
21
  adapter == 'postgresql'
18
22
  end
@@ -13,9 +13,10 @@ module DatabaseConsistency
13
13
 
14
14
  private
15
15
 
16
- def check
16
+ def check # rubocop:disable Metrics/AbcSize
17
17
  Helper.models.flat_map do |model|
18
- next unless configuration.enabled?(model.name.to_s)
18
+ next unless configuration.enabled?('DatabaseConsistencyDatabases', Helper.database_name(model)) &&
19
+ configuration.enabled?(model.name.to_s)
19
20
 
20
21
  Helper.first_level_associations(model).flat_map do |association|
21
22
  enabled_checkers.flat_map do |checker_class|
@@ -14,9 +14,10 @@ module DatabaseConsistency
14
14
 
15
15
  private
16
16
 
17
- def check
17
+ def check # rubocop:disable Metrics/AbcSize
18
18
  Helper.parent_models.flat_map do |model|
19
- next unless configuration.enabled?(model.name.to_s)
19
+ next unless configuration.enabled?('DatabaseConsistencyDatabases', Helper.database_name(model)) &&
20
+ configuration.enabled?(model.name.to_s)
20
21
 
21
22
  model.columns.flat_map do |column|
22
23
  enabled_checkers.flat_map do |checker_class|
@@ -10,9 +10,10 @@ module DatabaseConsistency
10
10
 
11
11
  private
12
12
 
13
- def check
13
+ def check # rubocop:disable Metrics/AbcSize
14
14
  Helper.models.flat_map do |model|
15
- next unless configuration.enabled?(model.name.to_s)
15
+ next unless configuration.enabled?('DatabaseConsistencyDatabases', Helper.database_name(model)) &&
16
+ configuration.enabled?(model.name.to_s)
16
17
 
17
18
  model.defined_enums.keys.flat_map do |enum|
18
19
  enabled_checkers.flat_map do |checker_class|
@@ -14,7 +14,8 @@ module DatabaseConsistency
14
14
 
15
15
  def check # rubocop:disable Metrics/AbcSize
16
16
  Helper.parent_models.flat_map do |model|
17
- next unless configuration.enabled?(model.name.to_s)
17
+ next unless configuration.enabled?('DatabaseConsistencyDatabases', Helper.database_name(model)) &&
18
+ configuration.enabled?(model.name.to_s)
18
19
 
19
20
  indexes = model.connection.indexes(model.table_name)
20
21
 
@@ -11,9 +11,10 @@ module DatabaseConsistency
11
11
  private
12
12
 
13
13
  # @return [Array<Hash>]
14
- def check
14
+ def check # rubocop:disable Metrics/AbcSize
15
15
  Helper.parent_models.flat_map do |model|
16
- next unless configuration.enabled?(model.name.to_s)
16
+ next unless configuration.enabled?('DatabaseConsistencyDatabases', Helper.database_name(model)) &&
17
+ configuration.enabled?(model.name.to_s)
17
18
 
18
19
  model._validators.flat_map do |attribute, validators|
19
20
  next unless attribute
@@ -12,9 +12,10 @@ module DatabaseConsistency
12
12
  private
13
13
 
14
14
  # @return [Array<Hash>]
15
- def check # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
15
+ def check # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
16
16
  Helper.parent_models.flat_map do |model|
17
- next unless configuration.enabled?(model.name.to_s)
17
+ next unless configuration.enabled?('DatabaseConsistencyDatabases', Helper.database_name(model)) &&
18
+ configuration.enabled?(model.name.to_s)
18
19
 
19
20
  model.validators.flat_map do |validator|
20
21
  next unless validator.respond_to?(:attributes)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.7.11'
4
+ VERSION = '1.7.12'
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: 1.7.11
4
+ version: 1.7.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: 2023-07-01 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord