Add index to 'parent_id' for users with large number of locations

This commit is contained in:
Brady Wetherington 2024-05-27 15:38:42 +01:00
parent 485caf1d92
commit 28b450fd3c

View file

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