Skip to content

Migrator

removeIndex()

removeIndex() — returns void

Available in: migration Category: Migration Functions

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.

NameTypeRequiredDefaultDescription
tablestringyesThe table name to perform the index operation on
indexNamestringyesthe name of the index to remove
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");