feat:项目任务用户表 添加索引 “userid”

This commit is contained in:
weifashi 2023-07-03 22:33:30 +08:00
parent eabbe82b39
commit 49f27ee4cd

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIndexToProjectTaskUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('project_task_users', function (Blueprint $table) {
if (Schema::hasColumn('project_task_users','userid')) {
$table->index('userid');
}
});
}
/**
* Reverse the migrations.
*
* @return voidw
*/
public function down()
{
Schema::table('project_task_users', function (Blueprint $table) {
$table->dropIndex(['userid']);
});
}
}