From 462f6bd9e313f041ecb9c340da4da5396b0abf02 Mon Sep 17 00:00:00 2001 From: pro Date: Mon, 26 Jan 2026 12:46:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:MNG=20=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=ED=8C=8C=EC=9D=BC=20=EC=A0=84=EC=B2=B4=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MNG에서 API로 이동된 마이그레이션: - sales_scenario_checklists - simulator_fields, category_groups - barobill_members, barobill_configs - coocon_configs, credit_inquiries - barobill_bank_transactions, account_codes - barobill_card_transactions 관련 테이블들 모든 DB 마이그레이션은 API 프로젝트에서 관리 Co-Authored-By: Claude Opus 4.5 --- ...create_sales_scenario_checklists_table.php | 36 +++++++++++ ...01_add_simulator_fields_to_items_table.php | 42 +++++++++++++ ...24_000002_create_category_groups_table.php | 53 ++++++++++++++++ ...2_084412_create_barobill_members_table.php | 44 +++++++++++++ ...2_091500_create_barobill_configs_table.php | 41 +++++++++++++ ...d_service_options_to_barobill_settings.php | 32 ++++++++++ ..._22_192637_create_coocon_configs_table.php | 34 +++++++++++ ...2_201143_create_credit_inquiries_table.php | 57 +++++++++++++++++ ...company_info_to_credit_inquiries_table.php | 55 +++++++++++++++++ ...reate_barobill_bank_transactions_table.php | 53 ++++++++++++++++ ...1_23_140000_create_account_codes_table.php | 37 +++++++++++ ...reate_barobill_card_transactions_table.php | 61 +++++++++++++++++++ ...barobill_card_transaction_splits_table.php | 52 ++++++++++++++++ ...ds_to_barobill_card_transactions_table.php | 34 +++++++++++ ...barobill_card_transaction_splits_table.php | 30 +++++++++ ...barobill_card_transaction_splits_table.php | 29 +++++++++ 16 files changed, 690 insertions(+) create mode 100644 database/migrations/2025_12_16_224112_create_sales_scenario_checklists_table.php create mode 100644 database/migrations/2025_12_24_000001_add_simulator_fields_to_items_table.php create mode 100644 database/migrations/2025_12_24_000002_create_category_groups_table.php create mode 100644 database/migrations/2026_01_22_084412_create_barobill_members_table.php create mode 100644 database/migrations/2026_01_22_091500_create_barobill_configs_table.php create mode 100644 database/migrations/2026_01_22_170000_add_service_options_to_barobill_settings.php create mode 100644 database/migrations/2026_01_22_192637_create_coocon_configs_table.php create mode 100644 database/migrations/2026_01_22_201143_create_credit_inquiries_table.php create mode 100644 database/migrations/2026_01_22_203001_add_company_info_to_credit_inquiries_table.php create mode 100644 database/migrations/2026_01_23_130000_create_barobill_bank_transactions_table.php create mode 100644 database/migrations/2026_01_23_140000_create_account_codes_table.php create mode 100644 database/migrations/2026_01_23_150000_create_barobill_card_transactions_table.php create mode 100644 database/migrations/2026_01_23_160000_create_barobill_card_transaction_splits_table.php create mode 100644 database/migrations/2026_01_23_180000_add_editable_fields_to_barobill_card_transactions_table.php create mode 100644 database/migrations/2026_01_23_190000_add_evidence_fields_to_barobill_card_transaction_splits_table.php create mode 100644 database/migrations/2026_01_23_191000_add_deduction_type_to_barobill_card_transaction_splits_table.php diff --git a/database/migrations/2025_12_16_224112_create_sales_scenario_checklists_table.php b/database/migrations/2025_12_16_224112_create_sales_scenario_checklists_table.php new file mode 100644 index 0000000..76e7160 --- /dev/null +++ b/database/migrations/2025_12_16_224112_create_sales_scenario_checklists_table.php @@ -0,0 +1,36 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->unsignedTinyInteger('step_id')->comment('단계 ID (1-6)'); + $table->unsignedTinyInteger('checkpoint_index')->comment('체크포인트 인덱스'); + $table->boolean('is_checked')->default(true); + $table->timestamps(); + + // 복합 유니크 키: 사용자별, 단계별, 체크포인트별 하나의 레코드 + $table->unique(['tenant_id', 'user_id', 'step_id', 'checkpoint_index'], 'sales_scenario_unique'); + $table->index(['tenant_id', 'user_id']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sales_scenario_checklists'); + } +}; diff --git a/database/migrations/2025_12_24_000001_add_simulator_fields_to_items_table.php b/database/migrations/2025_12_24_000001_add_simulator_fields_to_items_table.php new file mode 100644 index 0000000..8fd234b --- /dev/null +++ b/database/migrations/2025_12_24_000001_add_simulator_fields_to_items_table.php @@ -0,0 +1,42 @@ +string('process_type', 20)->nullable()->after('category_id') + ->comment('공정유형: screen, bending, electric, steel, assembly'); + + // 품목분류: 원단, 패널, 도장, 표면처리, 가이드레일, 케이스, 모터, 제어반 등 + $table->string('item_category', 50)->nullable()->after('process_type') + ->comment('품목분류: 원단, 패널, 도장, 가이드레일, 모터 등'); + + // 인덱스 추가 + $table->index('process_type', 'idx_items_process_type'); + $table->index('item_category', 'idx_items_item_category'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('items', function (Blueprint $table) { + $table->dropIndex('idx_items_process_type'); + $table->dropIndex('idx_items_item_category'); + $table->dropColumn(['process_type', 'item_category']); + }); + } +}; diff --git a/database/migrations/2025_12_24_000002_create_category_groups_table.php b/database/migrations/2025_12_24_000002_create_category_groups_table.php new file mode 100644 index 0000000..49394d9 --- /dev/null +++ b/database/migrations/2025_12_24_000002_create_category_groups_table.php @@ -0,0 +1,53 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + + // 코드: area_based, weight_based, quantity_based + $table->string('code', 50)->comment('코드: area_based, weight_based, quantity_based'); + + // 이름: 면적기반, 중량기반, 수량기반 + $table->string('name', 100)->comment('이름: 면적기반, 중량기반, 수량기반'); + + // 곱셈 변수: M(면적), K(중량), null(수량) + $table->string('multiplier_variable', 20)->nullable() + ->comment('곱셈 변수: M(면적), K(중량), null(수량기반)'); + + // 소속 카테고리 목록 (JSON 배열) + $table->json('categories')->nullable() + ->comment('소속 카테고리 목록: ["원단", "패널", "도장"]'); + + $table->text('description')->nullable(); + $table->unsignedInteger('sort_order')->default(0); + $table->boolean('is_active')->default(true); + + $table->timestamps(); + + // 인덱스 + $table->index('tenant_id', 'idx_category_groups_tenant'); + $table->unique(['tenant_id', 'code'], 'uq_category_groups_tenant_code'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('category_groups'); + } +}; diff --git a/database/migrations/2026_01_22_084412_create_barobill_members_table.php b/database/migrations/2026_01_22_084412_create_barobill_members_table.php new file mode 100644 index 0000000..d35a391 --- /dev/null +++ b/database/migrations/2026_01_22_084412_create_barobill_members_table.php @@ -0,0 +1,44 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('biz_no', 20)->comment('사업자번호'); + $table->string('corp_name', 100)->comment('상호명'); + $table->string('ceo_name', 50)->comment('대표자명'); + $table->string('addr', 255)->nullable()->comment('주소'); + $table->string('biz_type', 50)->nullable()->comment('업태'); + $table->string('biz_class', 50)->nullable()->comment('종목'); + $table->string('barobill_id', 50)->comment('바로빌 아이디'); + $table->string('barobill_pwd', 255)->comment('바로빌 비밀번호 (해시)'); + $table->string('manager_name', 50)->nullable()->comment('담당자명'); + $table->string('manager_email', 100)->nullable()->comment('담당자 이메일'); + $table->string('manager_hp', 20)->nullable()->comment('담당자 전화번호'); + $table->enum('status', ['active', 'inactive', 'pending'])->default('active')->comment('상태'); + $table->timestamps(); + $table->softDeletes(); + + $table->unique(['tenant_id', 'biz_no'], 'unique_tenant_biz_no'); + $table->index('status'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('barobill_members'); + } +}; diff --git a/database/migrations/2026_01_22_091500_create_barobill_configs_table.php b/database/migrations/2026_01_22_091500_create_barobill_configs_table.php new file mode 100644 index 0000000..7d0c0b5 --- /dev/null +++ b/database/migrations/2026_01_22_091500_create_barobill_configs_table.php @@ -0,0 +1,41 @@ +id(); + $table->string('name', 50)->comment('설정 이름 (예: 테스트서버, 운영서버)'); + $table->enum('environment', ['test', 'production'])->comment('환경 (test/production)'); + $table->string('cert_key', 100)->comment('CERTKEY (인증키)'); + $table->string('corp_num', 20)->nullable()->comment('파트너 사업자번호'); + $table->string('base_url', 255)->comment('API 서버 URL'); + $table->text('description')->nullable()->comment('설명'); + $table->boolean('is_active')->default(false)->comment('활성화 여부 (환경당 1개만 활성화)'); + $table->timestamps(); + $table->softDeletes(); + + // 환경별로 하나만 활성화 가능하도록 부분 유니크 인덱스 (is_active=true인 것 중에서) + $table->index(['environment', 'is_active']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('barobill_configs'); + } +}; diff --git a/database/migrations/2026_01_22_170000_add_service_options_to_barobill_settings.php b/database/migrations/2026_01_22_170000_add_service_options_to_barobill_settings.php new file mode 100644 index 0000000..cc20120 --- /dev/null +++ b/database/migrations/2026_01_22_170000_add_service_options_to_barobill_settings.php @@ -0,0 +1,32 @@ +boolean('use_tax_invoice')->default(false)->after('auto_issue')->comment('전자세금계산서 이용'); + $table->boolean('use_bank_account')->default(false)->after('use_tax_invoice')->comment('계좌조회 이용'); + $table->boolean('use_card_usage')->default(false)->after('use_bank_account')->comment('카드사용내역 이용'); + $table->boolean('use_hometax')->default(false)->after('use_card_usage')->comment('홈텍스매입/매출 이용'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('barobill_settings', function (Blueprint $table) { + $table->dropColumn(['use_tax_invoice', 'use_bank_account', 'use_card_usage', 'use_hometax']); + }); + } +}; diff --git a/database/migrations/2026_01_22_192637_create_coocon_configs_table.php b/database/migrations/2026_01_22_192637_create_coocon_configs_table.php new file mode 100644 index 0000000..8fa3050 --- /dev/null +++ b/database/migrations/2026_01_22_192637_create_coocon_configs_table.php @@ -0,0 +1,34 @@ +id(); + $table->string('name', 100)->comment('설정 이름'); + $table->enum('environment', ['test', 'production'])->default('test')->comment('환경'); + $table->string('api_key', 100)->comment('API 키'); + $table->string('base_url', 255)->comment('API 기본 URL'); + $table->text('description')->nullable()->comment('설명'); + $table->boolean('is_active')->default(false)->comment('활성화 여부'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('coocon_configs'); + } +}; diff --git a/database/migrations/2026_01_22_201143_create_credit_inquiries_table.php b/database/migrations/2026_01_22_201143_create_credit_inquiries_table.php new file mode 100644 index 0000000..d9e7834 --- /dev/null +++ b/database/migrations/2026_01_22_201143_create_credit_inquiries_table.php @@ -0,0 +1,57 @@ +id(); + $table->string('inquiry_key', 32)->unique()->comment('조회 고유 키'); + $table->string('company_key', 20)->index()->comment('사업자번호/법인번호'); + $table->string('company_name')->nullable()->comment('업체명'); + $table->unsignedBigInteger('user_id')->nullable()->comment('조회자 ID'); + $table->timestamp('inquired_at')->comment('조회 일시'); + + // 요약 정보 (빠른 조회용) + $table->unsignedInteger('short_term_overdue_cnt')->default(0)->comment('단기연체정보 건수'); + $table->unsignedInteger('negative_info_kci_cnt')->default(0)->comment('신용도판단정보(한국신용정보원) 건수'); + $table->unsignedInteger('negative_info_pb_cnt')->default(0)->comment('공공정보 건수'); + $table->unsignedInteger('negative_info_cb_cnt')->default(0)->comment('신용도판단정보(신용정보사) 건수'); + $table->unsignedInteger('suspension_info_cnt')->default(0)->comment('당좌거래정지정보 건수'); + $table->unsignedInteger('workout_cnt')->default(0)->comment('법정관리/워크아웃정보 건수'); + + // API 응답 원본 데이터 (JSON) + $table->json('raw_summary')->nullable()->comment('OA12 신용요약정보 원본'); + $table->json('raw_short_term_overdue')->nullable()->comment('OA13 단기연체정보 원본'); + $table->json('raw_negative_info_kci')->nullable()->comment('OA14 신용도판단정보(한국신용정보원) 원본'); + $table->json('raw_negative_info_cb')->nullable()->comment('OA15 신용도판단정보(신용정보사) 원본'); + $table->json('raw_suspension_info')->nullable()->comment('OA16 당좌거래정지정보 원본'); + $table->json('raw_workout_info')->nullable()->comment('OA17 법정관리/워크아웃정보 원본'); + + // 상태 + $table->enum('status', ['success', 'partial', 'failed'])->default('success')->comment('조회 상태'); + $table->text('error_message')->nullable()->comment('에러 메시지'); + + $table->timestamps(); + + // 인덱스 + $table->index(['company_key', 'inquired_at']); + $table->index('inquired_at'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('credit_inquiries'); + } +}; diff --git a/database/migrations/2026_01_22_203001_add_company_info_to_credit_inquiries_table.php b/database/migrations/2026_01_22_203001_add_company_info_to_credit_inquiries_table.php new file mode 100644 index 0000000..2844e11 --- /dev/null +++ b/database/migrations/2026_01_22_203001_add_company_info_to_credit_inquiries_table.php @@ -0,0 +1,55 @@ +string('ceo_name')->nullable()->after('company_name')->comment('대표자명'); + $table->string('company_address')->nullable()->after('ceo_name')->comment('회사 주소'); + $table->string('business_type')->nullable()->after('company_address')->comment('업종'); + $table->string('business_item')->nullable()->after('business_type')->comment('업태'); + $table->date('establishment_date')->nullable()->after('business_item')->comment('설립일'); + + // 국세청 사업자등록 상태 + $table->string('nts_status', 20)->nullable()->after('establishment_date')->comment('국세청 상태 (영업/휴업/폐업)'); + $table->string('nts_status_code', 2)->nullable()->after('nts_status')->comment('국세청 상태코드 (01/02/03)'); + $table->string('nts_tax_type', 50)->nullable()->after('nts_status_code')->comment('과세유형'); + $table->date('nts_closure_date')->nullable()->after('nts_tax_type')->comment('폐업일'); + + // API 원본 데이터 + $table->json('raw_company_info')->nullable()->after('raw_workout_info')->comment('OA08 기업기본정보 원본'); + $table->json('raw_nts_status')->nullable()->after('raw_company_info')->comment('국세청 상태조회 원본'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('credit_inquiries', function (Blueprint $table) { + $table->dropColumn([ + 'ceo_name', + 'company_address', + 'business_type', + 'business_item', + 'establishment_date', + 'nts_status', + 'nts_status_code', + 'nts_tax_type', + 'nts_closure_date', + 'raw_company_info', + 'raw_nts_status', + ]); + }); + } +}; 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 0000000..1079a55 --- /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'); + } +}; diff --git a/database/migrations/2026_01_23_140000_create_account_codes_table.php b/database/migrations/2026_01_23_140000_create_account_codes_table.php new file mode 100644 index 0000000..683e293 --- /dev/null +++ b/database/migrations/2026_01_23_140000_create_account_codes_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('tenant_id')->constrained()->onDelete('cascade'); + $table->string('code', 10)->comment('계정과목 코드'); + $table->string('name', 100)->comment('계정과목 명'); + $table->string('category', 50)->nullable()->comment('분류 (자산/부채/자본/수익/비용)'); + $table->integer('sort_order')->default(0)->comment('정렬순서'); + $table->boolean('is_active')->default(true)->comment('사용여부'); + $table->timestamps(); + + // 테넌트별 계정과목 코드 유니크 + $table->unique(['tenant_id', 'code'], 'account_codes_tenant_code_unique'); + $table->index(['tenant_id', 'is_active'], 'account_codes_tenant_active_idx'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('account_codes'); + } +}; diff --git a/database/migrations/2026_01_23_150000_create_barobill_card_transactions_table.php b/database/migrations/2026_01_23_150000_create_barobill_card_transactions_table.php new file mode 100644 index 0000000..4993d4a --- /dev/null +++ b/database/migrations/2026_01_23_150000_create_barobill_card_transactions_table.php @@ -0,0 +1,61 @@ +id(); + $table->foreignId('tenant_id')->constrained()->onDelete('cascade'); + $table->string('card_num', 50)->comment('카드번호'); + $table->string('card_company', 10)->nullable()->comment('카드사 코드'); + $table->string('card_company_name', 50)->nullable()->comment('카드사명'); + $table->string('use_dt', 20)->comment('사용일시 원본 (YYYYMMDDHHMMSS)'); + $table->string('use_date', 8)->comment('사용일 (YYYYMMDD)'); + $table->string('use_time', 6)->nullable()->comment('사용시간 (HHMMSS)'); + $table->string('approval_num', 50)->nullable()->comment('승인번호'); + $table->string('approval_type', 10)->nullable()->comment('승인유형 (1=승인, 2=취소)'); + $table->decimal('approval_amount', 18, 2)->default(0)->comment('승인금액'); + $table->decimal('tax', 18, 2)->default(0)->comment('부가세'); + $table->decimal('service_charge', 18, 2)->default(0)->comment('봉사료'); + $table->string('payment_plan', 10)->nullable()->comment('할부개월수'); + $table->string('currency_code', 10)->default('KRW')->comment('통화코드'); + $table->string('merchant_name', 255)->nullable()->comment('가맹점명'); + $table->string('merchant_biz_num', 20)->nullable()->comment('가맹점 사업자번호'); + $table->string('merchant_addr', 255)->nullable()->comment('가맹점 주소'); + $table->string('merchant_ceo', 100)->nullable()->comment('가맹점 대표자'); + $table->string('merchant_biz_type', 100)->nullable()->comment('가맹점 업종'); + $table->string('merchant_tel', 50)->nullable()->comment('가맹점 전화번호'); + $table->string('memo', 255)->nullable()->comment('메모'); + $table->string('use_key', 100)->nullable()->comment('사용키'); + $table->string('account_code', 50)->nullable()->comment('계정과목 코드'); + $table->string('account_name', 100)->nullable()->comment('계정과목 명'); + $table->timestamps(); + + // 복합 유니크 인덱스: 같은 거래는 중복 저장 방지 + $table->unique( + ['tenant_id', 'card_num', 'use_dt', 'approval_num', 'approval_amount'], + 'bb_card_trans_unique' + ); + + // 조회용 인덱스 + $table->index(['tenant_id', 'use_date'], 'bb_card_trans_tenant_date_idx'); + $table->index(['tenant_id', 'card_num', 'use_date'], 'bb_card_trans_tenant_card_date_idx'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('barobill_card_transactions'); + } +}; diff --git a/database/migrations/2026_01_23_160000_create_barobill_card_transaction_splits_table.php b/database/migrations/2026_01_23_160000_create_barobill_card_transaction_splits_table.php new file mode 100644 index 0000000..d1829e0 --- /dev/null +++ b/database/migrations/2026_01_23_160000_create_barobill_card_transaction_splits_table.php @@ -0,0 +1,52 @@ +id(); + $table->foreignId('tenant_id')->constrained()->onDelete('cascade'); + + // 원본 거래 고유키 (바로빌에서 가져온 원본 데이터 식별) + $table->string('original_unique_key', 200)->comment('원본 거래 고유키 (cardNum|useDt|approvalNum|amount)'); + + // 분개 정보 + $table->decimal('split_amount', 18, 2)->comment('분개 금액'); + $table->string('account_code', 50)->nullable()->comment('계정과목 코드'); + $table->string('account_name', 100)->nullable()->comment('계정과목명'); + $table->string('memo', 255)->nullable()->comment('분개 메모'); + $table->integer('sort_order')->default(0)->comment('정렬 순서'); + + // 원본 거래 정보 (조회 편의를 위해 저장) + $table->string('card_num', 50)->comment('카드번호'); + $table->string('use_dt', 20)->comment('사용일시 (YYYYMMDDHHMMSS)'); + $table->string('use_date', 8)->comment('사용일 (YYYYMMDD)'); + $table->string('approval_num', 50)->nullable()->comment('승인번호'); + $table->decimal('original_amount', 18, 2)->comment('원본 거래 총액'); + $table->string('merchant_name', 255)->nullable()->comment('가맹점명'); + + $table->timestamps(); + + // 인덱스 + $table->index(['tenant_id', 'original_unique_key'], 'bb_card_split_tenant_key_idx'); + $table->index(['tenant_id', 'use_date'], 'bb_card_split_tenant_date_idx'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('barobill_card_transaction_splits'); + } +}; diff --git a/database/migrations/2026_01_23_180000_add_editable_fields_to_barobill_card_transactions_table.php b/database/migrations/2026_01_23_180000_add_editable_fields_to_barobill_card_transactions_table.php new file mode 100644 index 0000000..5262372 --- /dev/null +++ b/database/migrations/2026_01_23_180000_add_editable_fields_to_barobill_card_transactions_table.php @@ -0,0 +1,34 @@ +string('deduction_type', 20)->nullable()->after('account_name')->comment('공제유형: deductible/non_deductible'); + // 증빙/판매자상호 (사용자 수정용) + $table->string('evidence_name', 255)->nullable()->after('deduction_type')->comment('증빙/판매자상호 (수정용)'); + // 내역 (사용자 수정용) + $table->string('description', 500)->nullable()->after('evidence_name')->comment('내역 (수정용)'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('barobill_card_transactions', function (Blueprint $table) { + $table->dropColumn(['deduction_type', 'evidence_name', 'description']); + }); + } +}; diff --git a/database/migrations/2026_01_23_190000_add_evidence_fields_to_barobill_card_transaction_splits_table.php b/database/migrations/2026_01_23_190000_add_evidence_fields_to_barobill_card_transaction_splits_table.php new file mode 100644 index 0000000..977efe7 --- /dev/null +++ b/database/migrations/2026_01_23_190000_add_evidence_fields_to_barobill_card_transaction_splits_table.php @@ -0,0 +1,30 @@ +string('evidence_name', 255)->nullable()->after('account_name')->comment('증빙/판매자상호'); + $table->string('description', 500)->nullable()->after('evidence_name')->comment('내역'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('barobill_card_transaction_splits', function (Blueprint $table) { + $table->dropColumn(['evidence_name', 'description']); + }); + } +}; diff --git a/database/migrations/2026_01_23_191000_add_deduction_type_to_barobill_card_transaction_splits_table.php b/database/migrations/2026_01_23_191000_add_deduction_type_to_barobill_card_transaction_splits_table.php new file mode 100644 index 0000000..45ace61 --- /dev/null +++ b/database/migrations/2026_01_23_191000_add_deduction_type_to_barobill_card_transaction_splits_table.php @@ -0,0 +1,29 @@ +string('deduction_type', 20)->nullable()->after('account_name')->comment('공제유형: deductible/non_deductible'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('barobill_card_transaction_splits', function (Blueprint $table) { + $table->dropColumn('deduction_type'); + }); + } +};