Class: DatabaseConsistency::Checkers::ForeignKeyCascadeChecker

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

Overview

This class checks that foreign key has a cascade option matching dependent option

Constant Summary collapse

Report =
ReportBuilder.define(
  DatabaseConsistency::Report,
  :cascade_option,
  :primary_table,
  :foreign_table,
  :primary_key,
  :foreign_key
)
OPTION_TO_CASCADE =
{
  delete: [:cascade],
  delete_all: [:cascade],
  nullify: [:nullify],
  restrict_with_exception: [nil, :restrict],
  restrict_with_error: [nil, :restrict]
}.freeze
DEPENDENT_OPTIONS =
OPTION_TO_CASCADE.keys.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