feat:법인카드 거래내역(card_transactions) 마이그레이션 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-05 07:44:09 +09:00
parent 00470b7d30
commit 2b5ac4c54d

View File

@@ -0,0 +1,36 @@
<?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('card_transactions')) {
return;
}
Schema::create('card_transactions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id');
$table->unsignedBigInteger('card_id')->nullable(); // corporate_cards.id
$table->date('transaction_date'); // 거래일
$table->string('time', 10)->nullable(); // 시간 (HH:MM)
$table->string('merchant', 200); // 가맹점명
$table->string('category', 50)->nullable(); // 카테고리
$table->bigInteger('amount')->default(0); // 금액 (음수=취소)
$table->string('approval_no', 50)->nullable(); // 승인번호
$table->string('status', 20)->default('approved'); // approved, cancelled
$table->text('memo')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index(['tenant_id', 'transaction_date']);
$table->index(['tenant_id', 'card_id']);
});
}
public function down(): void
{
Schema::dropIfExists('card_transactions');
}
};