<?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('barobill_bank_transactions', function (Blueprint $table) {
            $table->string('client_code', 50)->nullable()->comment('거래처 코드')->after('account_name');
            $table->string('client_name', 100)->nullable()->comment('거래처명')->after('client_code');
            $table->index(['tenant_id', 'client_code'], 'bb_trans_tenant_client_idx');
        });
    }

    public function down(): void
    {
        Schema::table('barobill_bank_transactions', function (Blueprint $table) {
            $table->dropIndex('bb_trans_tenant_client_idx');
            $table->dropColumn(['client_code', 'client_name']);
        });
    }
};
