<?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('orders_header', function (Blueprint $table) {
            $table->foreignId('bank_account_id')->nullable()->constrained('master_bank_accounts')->nullOnDelete();
        });
    }

    public function down(): void
    {
        Schema::table('orders_header', function (Blueprint $table) {
            $table->dropForeign(['bank_account_id']);
            $table->dropColumn('bank_account_id');
        });
    }
};
