Skip to main content

rename_mysql_index_if_exists

Function rename_mysql_index_if_exists 

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

Renames a MySQL index when the source exists and the target does not.

This is useful when a table or business term is renamed while preserving the physical index definition. Calling it repeatedly is safe.