class Avram::Migrator::CreateIndexStatement
Overview
Builds an SQL statement for creating an index using table name, column name(s), index type and unique flag.
Usage
For a single column:
CreateIndexStatement.new(:users, columns: :email, using: :btree, unique: true).build
# => "CREATE UNIQUE INDEX users_email_index ON users USING btree (email);"
For multiple columns:
CreateIndexStatement.new(:users, columns: [:email, :username], using: :btree, unique: true).build
# => "CREATE UNIQUE INDEX users_email_username_index ON users USING btree (email, username);"
Included Modules
Defined in:
avram/migrator/create_index_statement.crConstant Summary
-
ALLOWED_INDEX_TYPES =
["btree"] of ::String