techblog/database/migrations/2025_11_09_121802_create_comments_table.php

33 lines
771 B
PHP
Raw Permalink Normal View History

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('comments', function (Blueprint $table) {
$table->id();
$table->text('content');
$table->foreignId('post_id');
$table->foreignId('parent_comment_id');
$table->string('status', 32)->comment('approved, pending');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('comments');
}
};