Migrator
removeIndex()
Signature
Section titled “Signature”removeIndex() — returns void
Available in: migration
Category: Migration Functions
Description
Section titled “Description”Remove a database index Only available in a migration CFC
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
table | string | yes | — | The table name to perform the index operation on |
indexName | string | yes | — | the name of the index to remove |
Examples
Section titled “Examples”// 1. Remove an index by its name
removeIndex(table="members", indexName="members_username");
// 2. Remove a compound index created on multiple columns
// (index was previously added as "orders_customerid_createdat")
removeIndex(table="orders", indexName="orders_customerid_createdat");
// 3. Typical down() migration reversing an addIndex call
component extends="wheels.Migrator" {
function up() {
addIndex(table="articles", columnNames="slug", unique=true, indexName="articles_slug");
}
function down() {
removeIndex(table="articles", indexName="articles_slug");
}
}