给图片表增加索引

This commit is contained in:
Wisp X 2022-04-27 15:51:53 +08:00
parent 1434d6fa1c
commit 6291acbcee

View File

@ -0,0 +1,38 @@
<?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('images', function (Blueprint $table) {
$table->index('key');
$table->index('md5');
$table->index('sha1');
$table->index('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('images', function (Blueprint $table) {
$table->dropIndex('key');
$table->dropIndex('md5');
$table->dropIndex('sha1');
$table->dropIndex('created_at');
});
}
};