feat:journal_entries에 source_type, source_key 컬럼 추가

- 원본 거래 추적용 source_type(bank_transaction, hometax_invoice, manual) 컬럼 추가
- 원본 거래 고유키 source_key 컬럼 추가
- tenant_id + source_type + source_key 복합 인덱스 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-10 17:58:20 +09:00
parent d8fd221278
commit d0418eeb85

View File

@@ -0,0 +1,28 @@
<?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('journal_entries', function (Blueprint $table) {
$table->string('source_type', 30)->nullable()->after('status')
->comment('원본 거래 유형: bank_transaction, hometax_invoice, manual');
$table->string('source_key', 255)->nullable()->after('source_type')
->comment('원본 거래 고유키');
$table->index(['tenant_id', 'source_type', 'source_key'], 'je_source_idx');
});
}
public function down(): void
{
Schema::table('journal_entries', function (Blueprint $table) {
$table->dropIndex('je_source_idx');
$table->dropColumn(['source_type', 'source_key']);
});
}
};