database_consistency 1.2.1 → 1.2.2

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: 5774c6b4064a081e7a285013456b39fef68f39ec7dd536063c236d54abec3e84
4
- data.tar.gz: 18ed6073af882e007ec6ea70a9a55fad8daa8fef755049a3070d9f68ce1377dd
3
+ metadata.gz: 7f2d13b99e730f1045b98f63239a77820a81908d2ec05232461bf12275489d5d
4
+ data.tar.gz: 7f92339d4b0241a15f422f64fdd80eab8db3f64c7cd8c405f91d787851fa3400
5
5
  SHA512:
6
- metadata.gz: 575b90af564642b397b5a93d2c5a94a3b3b2fb8f6de12e40225361ebb96128df61a8d3e19fb4982986985c6bd1ae110539cc93f00688bab3b44205f7aa5f3716
7
- data.tar.gz: 051360a87facb2062451b17c59ff596156b0211dfbf73d6e3345c1b45d470f45177c280d6dd6fb59602faa719a959534252dc4f9615378724d2a321d39c64394
6
+ metadata.gz: 4970958fca4670dda454bdaf699e96c013fc443d9bfeea4e11638ed2ad38f567f1f07ddec0785310bfac9e7afc58dd014df94872519c6ed4b7bfb3a405cc5a75
7
+ data.tar.gz: b3656fa0f395f2e87914b4d217eeea445b9fca195d5db0a4ca9ac596bdf5a81a5662c18dc714a1191a9f61fe714814706428cff6c0816e295ffa15650ffd7917
@@ -25,8 +25,13 @@ module DatabaseConsistency
25
25
  end
26
26
 
27
27
  # @return [Array<Hash>]
28
- def reports
28
+ def reports(catch_errors: true)
29
29
  @reports ||= check
30
+ rescue StandardError => e
31
+ raise e unless catch_errors
32
+
33
+ RescueError.call(e)
34
+ []
30
35
  end
31
36
 
32
37
  # @return [Array<Class>]
@@ -16,7 +16,7 @@ module DatabaseConsistency
16
16
  Helper.parent_models.flat_map do |model|
17
17
  next unless configuration.enabled?(model.name.to_s)
18
18
 
19
- indexes = ActiveRecord::Base.connection.indexes(model.table_name)
19
+ indexes = model.connection.indexes(model.table_name)
20
20
 
21
21
  indexes.flat_map do |index|
22
22
  enabled_checkers.map do |checker_class|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.2.1'
4
+ VERSION = '1.2.2'
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.2.1
4
+ version: 1.2.2
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-09-08 00:00:00.000000000 Z
11
+ date: 2022-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  requirements: []
203
- rubygems_version: 3.3.21
203
+ rubygems_version: 3.0.3.1
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: Provide an easy way to check the consistency of the database constraints