4
0
Fork 0
dcat-admin/packages/keywords/updates/CreateKeywordsTable.php

40 lines
1.1 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateKeywordsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('keywords')) {
Schema::create('keywords', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->string('name')->comment('名字');
$table->string('value')->nullable();
$table->string('type_key')->nullable();
$table->unsignedInteger('sort')->default(0)->comment('排序');
$table->unsignedBigInteger('parent_id')->default(0)->comment('上级ID');
$table->unsignedInteger('level')->default(1)->comment('层级');
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('keywords');
}
};