WordPress Version: 5.3
/**
* Adds an index to a specified table.
*
* @since 1.0.1
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $table Database table name.
* @param string $index Database table index column.
* @return true True, when done with execution.
*/
function add_clean_index($table, $index)
{
global $wpdb;
drop_index($table, $index);
$wpdb->query("ALTER TABLE `{$table}` ADD INDEX ( `{$index}` )");
return true;
}