database_consistency 2.0.1 → 2.0.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: ba84801df64868302240abb6b325652bc21c34086c2b4d32460bb092f55d7681
4
- data.tar.gz: 49ba63ec3857648e90121ef8e7692fe217fcb41592b21087876628caa7888427
3
+ metadata.gz: 00b035e08de638007e2b5c13042544597dcdf30a4ea55b1a97dd4e55e16e7a1a
4
+ data.tar.gz: 9c6db1c345e64d271680c0e6effa6c84d72e2a6d4bde388a123f8ca109d157c3
5
5
  SHA512:
6
- metadata.gz: f29ab6930f1317041b38879890a0195ed03d7620647a08baa5061fd82cd5b124587f0acafa9fe15b1d92747b4a8e7f05528fb4882b170cdf6feb23ed326547aa
7
- data.tar.gz: a4e7fb560d24c41aa1dc02ad3127658ac9ab6f268be885843ca03cf24bc49e4354cec95f8d78a69ad44579eaef984a555c578e347eb98645de27248c75edfe3e
6
+ metadata.gz: 9b322ecb69172489a441031d971c5fcdea5e68d6ed6a31486dfe36cbab349f4ffb184970f35b1cf55585398b281b82db0916fb956bc276534f42907f62ae6e32
7
+ data.tar.gz: 22e56221e6711045aaeecedfc305914d8363817c19d376d4a46e89eb3e7d17ad379213e7e07a080ee2f8734679688e9b3d8690f16f5d5097809fae466072472f
@@ -7,6 +7,7 @@ module DatabaseConsistency
7
7
  Report = ReportBuilder.define(
8
8
  DatabaseConsistency::Report,
9
9
  :covered_index_name,
10
+ :table_name,
10
11
  :index_name
11
12
  )
12
13
 
@@ -39,6 +40,7 @@ module DatabaseConsistency
39
40
  error_message: nil,
40
41
  covered_index_name: covered_by_index&.name,
41
42
  index_name: index.name,
43
+ table_name: model.table_name,
42
44
  **report_attributes
43
45
  )
44
46
  end
@@ -7,7 +7,8 @@ module DatabaseConsistency
7
7
  Report = ReportBuilder.define(
8
8
  DatabaseConsistency::Report,
9
9
  :index_name,
10
- :covered_index_name
10
+ :covered_index_name,
11
+ :table_name
11
12
  )
12
13
 
13
14
  private
@@ -39,6 +40,7 @@ module DatabaseConsistency
39
40
  error_message: nil,
40
41
  index_name: index.name,
41
42
  covered_index_name: covered_by_index&.name,
43
+ table_name: model.table_name,
42
44
  **report_attributes
43
45
  )
44
46
  end
@@ -12,7 +12,7 @@ module DatabaseConsistency
12
12
  end
13
13
 
14
14
  def column_or_attribute_name
15
- nil
15
+ 'self'
16
16
  end
17
17
 
18
18
  def table_or_model_name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '2.0.1'
4
+ VERSION = '2.0.2'
5
5
  end
@@ -6,7 +6,8 @@ module DatabaseConsistency
6
6
  class RedundantIndex < MigrationBase # :nodoc:
7
7
  def attributes
8
8
  {
9
- index_name: report.index_name
9
+ index_name: report.index_name,
10
+ table_name: report.table_name
10
11
  }
11
12
  end
12
13
 
@@ -1,5 +1,5 @@
1
1
  class %<migration_name>s < ActiveRecord::Migration[%<migration_version>s]
2
2
  def change
3
- remove_index nil, name: '%<index_name>s'
3
+ remove_index '%<table_name>s', name: '%<index_name>s'
4
4
  end
5
5
  end
@@ -28,11 +28,16 @@ module DatabaseConsistency
28
28
  end
29
29
 
30
30
  def writer(report)
31
- klass = begin
32
- "DatabaseConsistency::Writers::Simple::#{report.error_slug.to_s.classify}".constantize
33
- rescue NameError
34
- Simple::DefaultMessage
35
- end
31
+ klass =
32
+ if report.error_slug
33
+ begin
34
+ "DatabaseConsistency::Writers::Simple::#{report.error_slug.to_s.classify}".constantize
35
+ rescue NameError
36
+ Simple::DefaultMessage
37
+ end
38
+ else
39
+ Simple::DefaultMessage
40
+ end
36
41
 
37
42
  klass.new(report, config: config)
38
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_consistency
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin