Class: DatabaseConsistency::Checkers::ForeignKeyTypeChecker

Inherits:
AssociationChecker show all
Defined in:
lib/database_consistency/checkers/association_checkers/foreign_key_type_checker.rb

Overview

This class checks if association’s foreign key type is the same as associated model’s primary key

Constant Summary collapse

INCONSISTENT_TYPE =
'associated model key (%a_f) with type (%a_t) mismatches key (%b_f) with type (%b_t)'
TYPES =
{
  'serial' => 'integer',
  'integer' => 'integer',
  'int' => 'integer',
  'bigserial' => 'bigint',
  'bigint' => 'bigint',
  'bigint unsigned' => 'bigint unsigned'
}.freeze

Instance Attribute Summary

Attributes inherited from AssociationChecker

#association, #model

Method Summary

Methods inherited from AssociationChecker

#column_or_attribute_name, #initialize, #table_or_model_name

Methods inherited from BaseChecker

checker_name, enabled?, #enabled?, #report, #report_if_enabled?

Constructor Details

This class inherits a constructor from DatabaseConsistency::Checkers::AssociationChecker