// There are two ways to handle this:
// 1. You can simply pass the column name wrapped in an array
// and let laravel sort out the rest:
Schema::table('users', function (Blueprint $table) {
$table->dropUnique(['email']);
// $table->dropIndex(['email']); --> this pattern also works for other constraints/indexes like this
});
// 2. You can remember the way laravel formats index names ([TABLE_NAME]_[COLUMN_NAME]_unique),
// and pass that as a string:
Schema::table('users', function (Blueprint $table) {
$table->dropUnique('users_email_unique');
});
Schema::table('table_name', function (Blueprint $table) {
$table->dropForeign(['foreign_key']);
$table->dropColumn('column_key');
});
PS: usually foreign_key = column_key
ex:
Schema::table('despatch_discrepancies', function (Blueprint $table) {
$table->dropForeign(['pick_detail_id']);
$table->dropColumn('pick_detail_id');
});
$table->dropForeign('posts_user_id_foreign');
$table->dropIndex(['state']); // Drops index 'geo_state_index'
$table->dropPrimary('users_id_primary');