38 lines
1012 B
PHP
38 lines
1012 B
PHP
<?php
|
||
|
||
use Illuminate\Database\Migrations\Migration;
|
||
use Illuminate\Database\Schema\Blueprint;
|
||
use Illuminate\Support\Facades\Schema;
|
||
|
||
class CreateCommentsTable extends Migration
|
||
{
|
||
/**
|
||
* Run the migrations.
|
||
*
|
||
* @return void
|
||
*/
|
||
public function up()
|
||
{
|
||
Schema::create('comments', function (Blueprint $table) {
|
||
$table->id();
|
||
$table->unsignedBigInteger('user_id')->index()->comment('评论用户');
|
||
$table->unsignedBigInteger('parent_id')->index()->comment('恢复XX');
|
||
$table->morphs('commentable');
|
||
$table->text('content')->comment('评论内容,如果单条的就直接用,其他的可以用json格式化存储');
|
||
$table->boolean('status')->default(0);
|
||
$table->timestamps();
|
||
$table->softDeletes();
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Reverse the migrations.
|
||
*
|
||
* @return void
|
||
*/
|
||
public function down()
|
||
{
|
||
Schema::dropIfExists('comments');
|
||
}
|
||
}
|