comment moderation improvments
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?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::table('comments', function (Blueprint $table) {
|
||||
$table->string('status')->default('pending')->after('body'); // pending, approved, rejected
|
||||
$table->foreignId('moderated_by')->nullable()->after('status')->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('moderated_at')->nullable()->after('moderated_by');
|
||||
$table->text('moderation_note')->nullable()->after('moderated_at');
|
||||
|
||||
$table->index('status');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('comments', function (Blueprint $table) {
|
||||
$table->dropForeign(['moderated_by']);
|
||||
$table->dropColumn(['status', 'moderated_by', 'moderated_at', 'moderation_note']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user