Class: DatabaseConsistency::Writers::SimpleWriter

Inherits:
BaseWriter
  • Object
show all
Defined in:
lib/database_consistency/writers/simple_writer.rb

Overview

The simplest formatter

Constant Summary collapse

SLUG_TO_WRITER =
{
  association_foreign_type_missing_null_constraint: Simple::AssociationForeignTypeMissingNullConstraint,
  association_missing_index: Simple::AssociationMissingIndex,
  association_missing_null_constraint: Simple::AssociationMissingNullConstraint,
  enum_values_inconsistent_with_ar_enum: Simple::EnumValuesInconsistentWithArEnum,
  enum_values_inconsistent_with_inclusion: Simple::EnumValuesInconsistentWithInclusion,
  has_one_missing_unique_index: Simple::HasOneMissingUniqueIndex,
  implicit_order_column_missing: Simple::ImplicitOrderColumnMissing,
  inconsistent_enum_type: Simple::InconsistentEnumType,
  inconsistent_types: Simple::InconsistentTypes,
  length_validator_greater_limit: Simple::LengthValidatorGreaterLimit,
  length_validator_lower_limit: Simple::LengthValidatorLowerLimit,
  length_validator_missing: Simple::LengthValidatorMissing,
  missing_association_class: Simple::MissingAssociationClass,
  missing_foreign_key: Simple::MissingForeignKey,
  missing_foreign_key_cascade: Simple::MissingForeignKeyCascade,
  missing_table: Simple::MissingTable,
  missing_unique_index: Simple::MissingUniqueIndex,
  missing_uniqueness_validation: Simple::MissingUniquenessValidation,
  null_constraint_association_misses_validator: Simple::NullConstraintAssociationMissesValidator,
  null_constraint_misses_validator: Simple::NullConstraintMissesValidator,
  null_constraint_missing: Simple::NullConstraintMissing,
  possible_null: Simple::PossibleNull,
  redundant_case_insensitive_option: Simple::RedundantCaseInsensitiveOption,
  redundant_index: Simple::RedundantIndex,
  redundant_unique_index: Simple::RedundantUniqueIndex,
  small_primary_key: Simple::SmallPrimaryKey,
  three_state_boolean: Simple::ThreeStateBoolean
}.freeze

Instance Attribute Summary

Attributes inherited from BaseWriter

#config, #results

Instance Method Summary collapse

Methods inherited from BaseWriter

#initialize, write

Constructor Details

This class inherits a constructor from DatabaseConsistency::Writers::BaseWriter

Instance Method Details

#writeObject



38
39
40
41
42
43
44
45
# File 'lib/database_consistency/writers/simple_writer.rb', line 38

def write
  results.select(&method(:write?))
         .map(&method(:writer))
         .group_by(&:unique_key)
         .each_value do |writers|
    puts message(writers)
  end
end