database_consistency 3.0.0 → 3.0.1

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/database_consistency/configuration.rb +1 -1
  3. data/lib/database_consistency/helper.rb +1 -1
  4. data/lib/database_consistency/rescue_error.rb +3 -3
  5. data/lib/database_consistency/version.rb +1 -1
  6. data/lib/database_consistency/writers/autofix/migration_base.rb +1 -1
  7. data/lib/database_consistency/writers/simple/association_foreign_type_missing_null_constraint.rb +1 -1
  8. data/lib/database_consistency/writers/simple/association_missing_index.rb +1 -1
  9. data/lib/database_consistency/writers/simple/association_missing_null_constraint.rb +1 -1
  10. data/lib/database_consistency/writers/simple/enum_values_inconsistent_with_ar_enum.rb +1 -1
  11. data/lib/database_consistency/writers/simple/enum_values_inconsistent_with_inclusion.rb +1 -1
  12. data/lib/database_consistency/writers/simple/has_one_missing_unique_index.rb +1 -1
  13. data/lib/database_consistency/writers/simple/implicit_order_column_missing.rb +1 -1
  14. data/lib/database_consistency/writers/simple/inconsistent_enum_type.rb +1 -1
  15. data/lib/database_consistency/writers/simple/inconsistent_types.rb +2 -2
  16. data/lib/database_consistency/writers/simple/length_validator_greater_limit.rb +1 -1
  17. data/lib/database_consistency/writers/simple/length_validator_lower_limit.rb +1 -1
  18. data/lib/database_consistency/writers/simple/length_validator_missing.rb +1 -1
  19. data/lib/database_consistency/writers/simple/missing_association_class.rb +1 -1
  20. data/lib/database_consistency/writers/simple/missing_foreign_key.rb +1 -1
  21. data/lib/database_consistency/writers/simple/missing_foreign_key_cascade.rb +1 -1
  22. data/lib/database_consistency/writers/simple/missing_index_find_by.rb +1 -1
  23. data/lib/database_consistency/writers/simple/missing_table.rb +1 -1
  24. data/lib/database_consistency/writers/simple/missing_unique_index.rb +1 -1
  25. data/lib/database_consistency/writers/simple/missing_uniqueness_validation.rb +1 -1
  26. data/lib/database_consistency/writers/simple/null_constraint_association_misses_validator.rb +1 -1
  27. data/lib/database_consistency/writers/simple/null_constraint_misses_validator.rb +1 -1
  28. data/lib/database_consistency/writers/simple/null_constraint_missing.rb +1 -1
  29. data/lib/database_consistency/writers/simple/possible_null.rb +1 -1
  30. data/lib/database_consistency/writers/simple/redundant_case_insensitive_option.rb +1 -1
  31. data/lib/database_consistency/writers/simple/redundant_index.rb +1 -1
  32. data/lib/database_consistency/writers/simple/redundant_unique_index.rb +1 -1
  33. data/lib/database_consistency/writers/simple/small_primary_key.rb +1 -1
  34. data/lib/database_consistency/writers/simple/three_state_boolean.rb +1 -1
  35. data/lib/database_consistency/writers/simple/view_missing_primary_key.rb +1 -1
  36. data/lib/database_consistency/writers/simple/view_primary_key_column_missing.rb +1 -1
  37. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d92e907cbb8ca8c49b6b4015614f9bc55074d37cb96130b97e62ef5266211d1
4
- data.tar.gz: c97b5ff7fb08271812b489ea695f20b0d45c56f5109bd1ec246e1704917b33cc
3
+ metadata.gz: 530670a1dff61ea7ba5cbdd22628c2c2151448af0df367afb4f4f204577f3134
4
+ data.tar.gz: b42ffbd20ccc21a292362a30f905fe2829c91635dfc347d8475d9772d2159fec
5
5
  SHA512:
6
- metadata.gz: 004c32a1588bc7cb59299352e09a1866f20229735d56b1290d337ce2322ecd4ff20918e817e26118461356a47b6a81580ede89f695be2ec9fdf2739f44a38064
7
- data.tar.gz: 52d25e2ee4da71b6130d442a2443c7f3e02ad84674f7d19d67270356ebe28889db57581907d5d65cc9579013fb9d3b073461e210f0320a90db14cad8bab5e024
6
+ metadata.gz: 6b2d3fef5f27beb7e78c10863cccaef2a53d1d5018284fea8bd0d359e6c51b9cc4d0121060ae49a0ce190d2be1616b94271836a851b5ff16f1d48bf48ced1848
7
+ data.tar.gz: 15c12a901db6176972dbac03ea900035c07f76ea748f4fe8e2cd45aae2c5046c2d047997b455f155c48c2aa3ca8c315ff956f6cabeae1edd108e09cee662886e
@@ -13,7 +13,7 @@ module DatabaseConsistency
13
13
  if existing_paths.any?
14
14
  puts "Loaded configurations: #{existing_paths.join(', ')}"
15
15
  else
16
- puts 'No configurations were provided'
16
+ puts 'No configuration files were provided'
17
17
  end
18
18
 
19
19
  @configuration = extract_configurations(existing_paths)
@@ -49,7 +49,7 @@ module DatabaseConsistency
49
49
  def connected?(klass)
50
50
  klass.connection
51
51
  rescue ActiveRecord::ConnectionNotEstablished
52
- puts "#{klass} doesn't have active connection: ignoring"
52
+ puts "#{klass} does not have an active connection, skipping"
53
53
  false
54
54
  end
55
55
 
@@ -16,9 +16,9 @@ module DatabaseConsistency
16
16
  end
17
17
 
18
18
  def initialize
19
- puts 'Hey, some checks fail with an error, please open an issue on github at https://github.com/djezzzl/database_consistency.'
20
- puts "Attach the created file: #{filename}"
21
- puts 'Thank you, for your contribution!'
19
+ puts 'Some checks failed with an error. Please open an issue on GitHub at https://github.com/djezzzl/database_consistency.'
20
+ puts "Attach the generated file: #{filename}"
21
+ puts 'Thank you for your contribution!'
22
22
  puts '(c) Evgeniy Demin <lawliet.djez@gmail.com>'
23
23
  end
24
24
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.1'
5
5
  end
@@ -10,7 +10,7 @@ module DatabaseConsistency
10
10
  file_path = migration_path(migration_name)
11
11
 
12
12
  if Dir[migration_path_pattern(migration_name)].any?
13
- p "Skipping migration #{migration_name} because it already exists"
13
+ puts "Skipping migration #{migration_name} because it already exists"
14
14
  else
15
15
  File.write(file_path, migration)
16
16
  end
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'association foreign type column should be required in the database'
10
+ 'association foreign type column should be NOT NULL'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'associated model should have proper index in the database'
10
+ 'associated model should have an index in the database'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'association foreign key column should be required in the database'
10
+ 'association foreign key column should be NOT NULL'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'enum has [%<enum_values>s] values but ActiveRecord enum has [%<declared_values>s] values'
10
+ 'database enum has values [%<enum_values>s] but ActiveRecord enum has values [%<declared_values>s]'
11
11
  end
12
12
 
13
13
  def attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'enum has [%<enum_values>s] values but ActiveRecord inclusion validation has [%<declared_values>s] values'
10
+ 'database enum has values [%<enum_values>s] but inclusion validation has values [%<declared_values>s]'
11
11
  end
12
12
 
13
13
  def attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'associated model should have proper unique index in the database'
10
+ 'associated model should have a unique index in the database'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'implicit_order_column is recommended when using uuid column type for primary key'
10
+ 'setting implicit_order_column is recommended when using UUID as the primary key type'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'enum has %<values_types>s types but column has %<column_type>s type'
10
+ 'enum values have %<values_types>s types but the column has %<column_type>s type'
11
11
  end
12
12
 
13
13
  def attributes
@@ -7,8 +7,8 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- "foreign key (%<fk_name>s) with type (%<fk_type>s) doesn't "\
11
- 'cover primary key (%<pk_name>s) with type (%<pk_type>s)'
10
+ 'foreign key (%<fk_name>s) with type (%<fk_type>s) does not match '\
11
+ 'primary key (%<pk_name>s) with type (%<pk_type>s)'
12
12
  end
13
13
 
14
14
  def attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'column has greater limit in the database than in length validator'
10
+ 'column character limit is greater than the length validator allows'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'column has lower limit in the database than in length validator'
10
+ 'column character limit is less than the length validator allows'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'column has limit in the database but do not have length validator'
10
+ 'column has a character length limit but does not have a length validator'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'refers to undefined model %<class_name>s'
10
+ 'refers to a non-existent model %<class_name>s'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'should have foreign key in the database'
10
+ 'should have a foreign key in the database'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'should have foreign key with on_delete: :%<cascade_option>s in the database'
10
+ 'should have a foreign key with on_delete: :%<cascade_option>s in the database'
11
11
  end
12
12
 
13
13
  def attributes
@@ -13,7 +13,7 @@ module DatabaseConsistency
13
13
  def attributes
14
14
  if report.source_location
15
15
  count = report.total_findings_count || 1
16
- count_str = count > 1 ? ", and #{count - 1} more occurrences" : ''
16
+ count_str = count > 1 ? ", and #{count - 1} more" : ''
17
17
  { source_location: " (found at #{report.source_location}#{count_str})" }
18
18
  else
19
19
  { source_location: '' }
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'should have a table in the database'
10
+ 'should have a corresponding table in the database'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'model should have proper unique index in the database'
10
+ 'model should have a unique index in the database'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'index is unique in the database but do not have uniqueness validator'
10
+ 'index is unique in the database but does not have a uniqueness validator'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'column is required in the database but do not have presence validator for association %<association_name>s'
10
+ 'column is NOT NULL but does not have a presence validator for association %<association_name>s'
11
11
  end
12
12
 
13
13
  def attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'column is required in the database but does not have a validator disallowing nil values'
10
+ 'column is NOT NULL but does not have a validator disallowing nil values'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'column should be required in the database'
10
+ 'column should be NOT NULL'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'column is required but there is possible null value insert'
10
+ 'column is NOT NULL but may receive a NULL value'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- "has case insensitive type and doesn't require case_sensitive: false option"
10
+ 'column has a case-insensitive type and does not need the case_sensitive: false option'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'index is redundant as %<covered_index_name>s covers it'
10
+ 'index is redundant because %<covered_index_name>s covers it'
11
11
  end
12
12
 
13
13
  def attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'index uniqueness is redundant as %<covered_index_name>s covers it'
10
+ 'index uniqueness is redundant because %<covered_index_name>s covers it'
11
11
  end
12
12
 
13
13
  def attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'column has int/serial type but recommended to have bigint/bigserial/uuid'
10
+ 'column has int/serial type but it is recommended to use bigint/bigserial/uuid'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'boolean column should have NOT NULL constraint'
10
+ 'boolean column should be NOT NULL'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'model pointing to a view should have primary_key set'
10
+ 'model backed by a database view should have primary_key set'
11
11
  end
12
12
 
13
13
  def unique_attributes
@@ -7,7 +7,7 @@ module DatabaseConsistency
7
7
  private
8
8
 
9
9
  def template
10
- 'model pointing to a view has a non-existent primary_key column set'
10
+ 'model backed by a database view has primary_key set to a non-existent column'
11
11
  end
12
12
 
13
13
  def unique_attributes
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: 3.0.0
4
+ version: 3.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: 2026-03-02 00:00:00.000000000 Z
11
+ date: 2026-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord