From 5675c3cece293b81db6b5a99ff3426e592f2e6cb Mon Sep 17 00:00:00 2001 From: pro Date: Fri, 23 Jan 2026 11:11:28 +0900 Subject: [PATCH] =?UTF-8?q?fix:=EB=B0=94=EB=A1=9C=EB=B9=8C=20=EC=9E=85?= =?UTF-8?q?=EC=B6=9C=EA=B8=88=EB=82=B4=EC=97=AD=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EB=AA=85=20=EB=B3=80=EA=B2=BD=20(barobill=5Fbank=5Ftr?= =?UTF-8?q?ansactions)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 기존 bank_transactions 테이블과 충돌 방지 - 테이블명을 barobill_bank_transactions로 변경 Co-Authored-By: Claude Opus 4.5 --- app/Models/Barobill/BankTransaction.php | 4 +- ...reate_barobill_bank_transactions_table.php | 53 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2026_01_23_130000_create_barobill_bank_transactions_table.php diff --git a/app/Models/Barobill/BankTransaction.php b/app/Models/Barobill/BankTransaction.php index a6d833e6..2d4d0a12 100644 --- a/app/Models/Barobill/BankTransaction.php +++ b/app/Models/Barobill/BankTransaction.php @@ -7,12 +7,14 @@ use App\Models\Tenants\Tenant; /** - * 계좌 입출금 내역 모델 + * 바로빌 계좌 입출금 내역 모델 * * 바로빌에서 조회한 입출금 내역에 계정과목을 추가하여 저장 */ class BankTransaction extends Model { + protected $table = 'barobill_bank_transactions'; + protected $fillable = [ 'tenant_id', 'bank_account_num', diff --git a/database/migrations/2026_01_23_130000_create_barobill_bank_transactions_table.php b/database/migrations/2026_01_23_130000_create_barobill_bank_transactions_table.php new file mode 100644 index 00000000..1079a552 --- /dev/null +++ b/database/migrations/2026_01_23_130000_create_barobill_bank_transactions_table.php @@ -0,0 +1,53 @@ +id(); + $table->foreignId('tenant_id')->constrained()->onDelete('cascade'); + $table->string('bank_account_num', 50)->comment('계좌번호'); + $table->string('bank_code', 10)->nullable()->comment('은행코드'); + $table->string('bank_name', 50)->nullable()->comment('은행명'); + $table->string('trans_date', 8)->comment('거래일 (YYYYMMDD)'); + $table->string('trans_time', 6)->nullable()->comment('거래시간 (HHMMSS)'); + $table->string('trans_dt', 20)->comment('거래일시 원본 (YYYYMMDDHHMMSS)'); + $table->decimal('deposit', 18, 2)->default(0)->comment('입금액'); + $table->decimal('withdraw', 18, 2)->default(0)->comment('출금액'); + $table->decimal('balance', 18, 2)->default(0)->comment('잔액'); + $table->string('summary', 255)->nullable()->comment('적요'); + $table->string('cast', 100)->nullable()->comment('상대방'); + $table->string('memo', 255)->nullable()->comment('메모'); + $table->string('trans_office', 100)->nullable()->comment('거래점'); + $table->string('account_code', 50)->nullable()->comment('계정과목 코드'); + $table->string('account_name', 100)->nullable()->comment('계정과목 명'); + $table->timestamps(); + + // 복합 유니크 인덱스: 같은 거래는 중복 저장 방지 + $table->unique( + ['tenant_id', 'bank_account_num', 'trans_dt', 'deposit', 'withdraw', 'balance'], + 'barobill_bank_trans_unique' + ); + + // 조회용 인덱스 + $table->index(['tenant_id', 'trans_date'], 'bb_trans_tenant_date_idx'); + $table->index(['tenant_id', 'bank_account_num', 'trans_date'], 'bb_trans_tenant_acct_date_idx'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('barobill_bank_transactions'); + } +};