class Avram::Migrator::CreateForeignKeyStatement
Overview
Generates an ALTER TABLE statement for adding a foreign key constraint on a table.
Usage
CreateForeignKeyStatement.new(from: :comments, to: :users, column: :author_id, primary_key: :uid, on_delete: :cascade).build
# => "ALTER TABLE comments ADD CONSTRAINT comments_author_id_fk FOREIGN KEY (author_id) REFERENCES users (uid) ON DELETE CASCADE;"
Defined in:
avram/migrator/create_foreign_key_statement.crConstructors
Instance Method Summary
Instance methods inherited from class Object
blank_for_validates_required? : Bool
blank_for_validates_required?
Constructor Detail
def self.new(from : Symbol, to : Symbol, on_delete : Symbol, column : Symbol | Nil = nil, primary_key : Symbol = :id)
#