class Avram::Migrator::DropIndexStatement
Overview
Builds an SQL statement for dropping an index by inferring it's name using table name and column(s).
Usage
For a single column index:
DropIndexStatement.new(:users, :email, if_exists: true, on_delete: :cascade).build
# => "DROP INDEX IF EXISTS users_email_index CASCADE;"
For multiple column index:
DropIndexStatement.new(:users, [:email, :username] if_exists: true, on_delete: :cascade).build
# => "DROP INDEX IF EXISTS users_email_username_index CASCADE;"
Included Modules
Defined in:
avram/migrator/drop_index_statement.crConstant Summary
-
ALLOWED_ON_DELETE_STRATEGIES =
[:cascade, :restrict] of ::Symbol
Constructors
Instance Method Summary
Instance methods inherited from module Avram::Migrator::IndexStatementHelpers
add_index(column : Symbol, unique = false, using : Symbol = :btree)
add_index,
index_added?(index : String, column : Symbol)
index_added?
Instance methods inherited from class Object
blank_for_validates_required? : Bool
blank_for_validates_required?
Constructor Detail
def self.new(table : Symbol, columns : Columns, if_exists : Bool = false, on_delete : Symbol = :do_nothing)
#