Skip to main content

drop_index_if_exists

Function drop_index_if_exists 

Source
pub async fn drop_index_if_exists<C>(
    db: &C,
    table_name: &str,
    index_name: &str,
) -> Result<(), DbErr>
where C: ConnectionTrait,
Expand description

Drops an index when it exists across all supported database backends.

MySQL does not support DROP INDEX IF EXISTS, so this helper checks information_schema.statistics before issuing the backend-specific drop.