Class: DatabaseConsistency::Writers::SimpleWriter
- Inherits:
-
BaseWriter
- Object
- BaseWriter
- DatabaseConsistency::Writers::SimpleWriter
- Defined in:
- lib/database_consistency/writers/simple_writer.rb
Overview
The simplest formatter
Constant Summary collapse
- COLORS =
{ blue: "\e[34m", yellow: "\e[33m", green: "\e[32m", red: "\e[31m" }.freeze
- COLOR_BY_STATUS =
{ ok: :green, warning: :yellow, fail: :red }.freeze
- SLUG_TO_MESSAGE =
{ missing_foreign_key: 'should have foreign key in the database', inconsistent_types: "foreign key %<fk_name>s with type %<fk_type>s doesn't cover primary key %<pk_name>s with type %<pk_type>s", # rubocop:disable Layout/LineLength has_one_missing_unique_index: 'associated model should have proper unique index in the database', association_missing_index: 'associated model should have proper index in the database', length_validator_missing: 'column has limit in the database but do not have length validator', length_validator_greater_limit: 'column has greater limit in the database than in length validator', length_validator_lower_limit: 'column has lower limit in the database than in length validator', null_constraint_association_misses_validator: 'column is required in the database but do not have presence validator for association %<association_name>s', # rubocop:disable Layout/LineLength null_constraint_misses_validator: 'column is required in the database but do not have presence validator', small_primary_key: 'column has int/serial type but recommended to have bigint/bigserial/uuid', redundant_index: 'index is redundant as %<index_name>s covers it', redundant_unique_index: 'index uniqueness is redundant as %<index_name>s covers it', missing_uniqueness_validation: 'index is unique in the database but do not have uniqueness validator', missing_unique_index: 'model should have proper unique index in the database', possible_null: 'column is required but there is possible null value insert', null_constraint_missing: 'column should be required in the database', association_missing_null_constraint: 'association foreign key column should be required in the database' }.freeze
Instance Attribute Summary
Attributes inherited from BaseWriter
Instance Method Summary collapse
Methods inherited from BaseWriter
Constructor Details
This class inherits a constructor from DatabaseConsistency::Writers::BaseWriter
Instance Method Details
#write ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/database_consistency/writers/simple_writer.rb', line 41 def write results.each do |result| next unless write?(result.status) puts msg(result) end end |