database_consistency
Advanced tools
@@ -16,3 +16,3 @@ # frozen_string_literal: true | ||
| else | ||
| puts 'No configurations were provided' | ||
| puts 'No configuration files were provided' | ||
| end | ||
@@ -19,0 +19,0 @@ |
@@ -52,3 +52,3 @@ # frozen_string_literal: true | ||
| rescue ActiveRecord::ConnectionNotEstablished | ||
| puts "#{klass} doesn't have active connection: ignoring" | ||
| puts "#{klass} does not have an active connection, skipping" | ||
| false | ||
@@ -55,0 +55,0 @@ end |
@@ -19,5 +19,5 @@ # frozen_string_literal: true | ||
| def initialize | ||
| puts 'Hey, some checks fail with an error, please open an issue on github at https://github.com/djezzzl/database_consistency.' | ||
| puts "Attach the created file: #{filename}" | ||
| puts 'Thank you, for your contribution!' | ||
| puts 'Some checks failed with an error. Please open an issue on GitHub at https://github.com/djezzzl/database_consistency.' | ||
| puts "Attach the generated file: #{filename}" | ||
| puts 'Thank you for your contribution!' | ||
| puts '(c) Evgeniy Demin <lawliet.djez@gmail.com>' | ||
@@ -24,0 +24,0 @@ end |
| # frozen_string_literal: true | ||
| module DatabaseConsistency | ||
| VERSION = '3.0.0' | ||
| VERSION = '3.0.1' | ||
| end |
@@ -13,3 +13,3 @@ # frozen_string_literal: true | ||
| if Dir[migration_path_pattern(migration_name)].any? | ||
| p "Skipping migration #{migration_name} because it already exists" | ||
| puts "Skipping migration #{migration_name} because it already exists" | ||
| else | ||
@@ -16,0 +16,0 @@ File.write(file_path, migration) |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'association foreign type column should be required in the database' | ||
| 'association foreign type column should be NOT NULL' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'associated model should have proper index in the database' | ||
| 'associated model should have an index in the database' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'association foreign key column should be required in the database' | ||
| 'association foreign key column should be NOT NULL' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'enum has [%<enum_values>s] values but ActiveRecord enum has [%<declared_values>s] values' | ||
| 'database enum has values [%<enum_values>s] but ActiveRecord enum has values [%<declared_values>s]' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'enum has [%<enum_values>s] values but ActiveRecord inclusion validation has [%<declared_values>s] values' | ||
| 'database enum has values [%<enum_values>s] but inclusion validation has values [%<declared_values>s]' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'associated model should have proper unique index in the database' | ||
| 'associated model should have a unique index in the database' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'implicit_order_column is recommended when using uuid column type for primary key' | ||
| 'setting implicit_order_column is recommended when using UUID as the primary key type' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'enum has %<values_types>s types but column has %<column_type>s type' | ||
| 'enum values have %<values_types>s types but the column has %<column_type>s type' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,4 +10,4 @@ # frozen_string_literal: true | ||
| def template | ||
| "foreign key (%<fk_name>s) with type (%<fk_type>s) doesn't "\ | ||
| 'cover primary key (%<pk_name>s) with type (%<pk_type>s)' | ||
| 'foreign key (%<fk_name>s) with type (%<fk_type>s) does not match '\ | ||
| 'primary key (%<pk_name>s) with type (%<pk_type>s)' | ||
| end | ||
@@ -14,0 +14,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'column has greater limit in the database than in length validator' | ||
| 'column character limit is greater than the length validator allows' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'column has lower limit in the database than in length validator' | ||
| 'column character limit is less than the length validator allows' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'column has limit in the database but do not have length validator' | ||
| 'column has a character length limit but does not have a length validator' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'refers to undefined model %<class_name>s' | ||
| 'refers to a non-existent model %<class_name>s' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'should have foreign key with on_delete: :%<cascade_option>s in the database' | ||
| 'should have a foreign key with on_delete: :%<cascade_option>s in the database' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'should have foreign key in the database' | ||
| 'should have a foreign key in the database' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -16,3 +16,3 @@ # frozen_string_literal: true | ||
| count = report.total_findings_count || 1 | ||
| count_str = count > 1 ? ", and #{count - 1} more occurrences" : '' | ||
| count_str = count > 1 ? ", and #{count - 1} more" : '' | ||
| { source_location: " (found at #{report.source_location}#{count_str})" } | ||
@@ -19,0 +19,0 @@ else |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'should have a table in the database' | ||
| 'should have a corresponding table in the database' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'model should have proper unique index in the database' | ||
| 'model should have a unique index in the database' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'index is unique in the database but do not have uniqueness validator' | ||
| 'index is unique in the database but does not have a uniqueness validator' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'column is required in the database but do not have presence validator for association %<association_name>s' | ||
| 'column is NOT NULL but does not have a presence validator for association %<association_name>s' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'column is required in the database but does not have a validator disallowing nil values' | ||
| 'column is NOT NULL but does not have a validator disallowing nil values' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'column should be required in the database' | ||
| 'column should be NOT NULL' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'column is required but there is possible null value insert' | ||
| 'column is NOT NULL but may receive a NULL value' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| "has case insensitive type and doesn't require case_sensitive: false option" | ||
| 'column has a case-insensitive type and does not need the case_sensitive: false option' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'index is redundant as %<covered_index_name>s covers it' | ||
| 'index is redundant because %<covered_index_name>s covers it' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'index uniqueness is redundant as %<covered_index_name>s covers it' | ||
| 'index uniqueness is redundant because %<covered_index_name>s covers it' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'column has int/serial type but recommended to have bigint/bigserial/uuid' | ||
| 'column has int/serial type but it is recommended to use bigint/bigserial/uuid' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'boolean column should have NOT NULL constraint' | ||
| 'boolean column should be NOT NULL' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'model pointing to a view should have primary_key set' | ||
| 'model backed by a database view should have primary_key set' | ||
| end | ||
@@ -13,0 +13,0 @@ |
@@ -10,3 +10,3 @@ # frozen_string_literal: true | ||
| def template | ||
| 'model pointing to a view has a non-existent primary_key column set' | ||
| 'model backed by a database view has primary_key set to a non-existent column' | ||
| end | ||
@@ -13,0 +13,0 @@ |