<?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
    {
        if (!Schema::hasTable('leadership_ranks')) {
            return;
        }

        Schema::table('leadership_ranks', function (Blueprint $table) {
            $table->boolean('keep_count_after_unverify')->default(true)->after('count_start_at');
        });
    }

    public function down(): void
    {
        if (!Schema::hasTable('leadership_ranks') || !Schema::hasColumn('leadership_ranks', 'keep_count_after_unverify')) {
            return;
        }

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