<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('forum_categories', function (Blueprint $table) {
            $table->boolean('moderation_enabled')->default(false)->after('order');
        });

        Schema::table('forum_threads', function (Blueprint $table) {
            $table->boolean('is_approved')->default(true)->after('content');
        });

        Schema::table('forum_replies', function (Blueprint $table) {
            $table->boolean('is_approved')->default(true)->after('content');
        });
    }

    public function down(): void
    {
        Schema::table('forum_replies', function (Blueprint $table) {
            $table->dropColumn('is_approved');
        });

        Schema::table('forum_threads', function (Blueprint $table) {
            $table->dropColumn('is_approved');
        });

        Schema::table('forum_categories', function (Blueprint $table) {
            $table->dropColumn('moderation_enabled');
        });
    }
};
