<?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::hasColumn('pension_cases', 'account_name')) {
            Schema::table('pension_cases', function (Blueprint $table) {
                $table->string('account_name')
                    ->nullable()
                    ->after('fee_structure');
            });
        }
    }

    public function down(): void {
        if (Schema::hasColumn('pension_cases', 'account_name')) {
                Schema::table('pension_cases', function (Blueprint $table) {
                    $table->dropColumn('account_name');
                });
        }
    }
};
