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 covers associated model's primary key (same or bigger)

Constant Summary collapse

ALLOWED_TYPES =
class Report < DatabaseConsistency::Report # :nodoc:
  attr_reader :pk_name, :pk_type, :fk_name, :fk_type, :table_to_change, :type_to_set

  def initialize(fk_name: nil, fk_type: nil, pk_name: nil, pk_type: nil, table_to_change: nil, type_to_set: nil, **args) # rubocop:disable Metrics/ParameterLists, Layout/LineLength
    super(**args)
    @table_to_change = table_to_change
    @type_to_set = type_to_set
    @fk_name = fk_name
    @fk_type = fk_type
    @pk_name = pk_name
    @pk_type = pk_type
  end
end

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