Indexes are used to find rows with specific column values quickly.
Laravel will automatically construct a basic index name based on the table, column names, and index type (basic) when creating an index. To drop an basic index, you must first give it a name.
Create a basic index with users_name_index name.
$table->index('name');
users_name_index - is name of Basic Index.
We can drop basic index by index name.
$table->dropIndex('users_name_index');
Also we can drop basic index by column name. It will drop index users_name_index
$table->dropIndex(['name']);
Create a composite basic index with users_name_email_index name.
$table->index(['email', 'name']);
users_name_email_index - is name of Composite Basic Index.
$table->dropIndex('users_name_email_index');
MySQL has a limit here: 64 characters for basic index name length. You may need to set the index name yourself.
// basic index
$table->index('id', 'custom_basic_index_name');
// composite basic index
$table->index(['id', 'parent_id'], 'custom_basic_index_name');
$table->renameIndex('articles_id_parent_id_index', 'articles_id_parent_id_index_custom')