<?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->timestamp('count_start_at')->nullable()->after('need_level3_members');
        });
    }

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

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