Migrator
removeIndex()
Signature
Section titled “Signature”removeIndex() — returns void
Available in: migration
Category: Migration Functions
Description
Section titled “Description”Used to delete an index from a database table within a migration CFC. Indexes are typically added to improve query performance, but there are scenarios where an index becomes unnecessary or needs to be replaced. Using removeIndex() allows you to safely remove an index while maintaining database integrity. 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 from the members table
removeIndex(table="members", indexName="members_username");
2. Remove an index from the orders table
removeIndex(table="orders", indexName="orders_createdAt_idx");
3. Remove multiple indexes in separate calls
removeIndex(table="products", indexName="products_name_idx");
removeIndex(table="products", indexName="products_category_idx");