Files
zh-chat-server/database/migrations/2022_10_27_103303_create_comments_table.php
2022-11-01 11:07:41 +08:00

38 lines
1012 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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');
}
}