Add index migration

This commit is contained in:
Daniel Supernault 2022-12-20 01:03:19 -07:00
parent a2f8aad1d5
commit e27d1a4424
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 34 additions and 1 deletions

View file

@ -27,7 +27,8 @@ class AddItemIdAndItemTypeIndexesToNotificationsTable extends Migration
public function down()
{
Schema::table('notifications', function (Blueprint $table) {
//
$table->dropIndex('notifications_item_id_index');
$table->dropIndex('notifications_item_type_index');
});
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('notifications', function (Blueprint $table) {
$table->index('action');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('notifications', function (Blueprint $table) {
$table->dropIndex('notifications_action_index');
});
}
};