From bdf6bcc480d7481b0368ae435db8c4e304f62bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Fri, 6 Feb 2026 15:23:37 +0900 Subject: [PATCH] =?UTF-8?q?feat:=EC=9D=BC=EB=B0=98=EC=A0=84=ED=91=9C?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=20=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80=20(journal=5Fentries,?= =?UTF-8?q?=20journal=5Fentry=5Flines)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- ...06_300000_create_journal_entries_table.php | 36 +++++++++++++++++ ...00001_create_journal_entry_lines_table.php | 40 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 database/migrations/2026_02_06_300000_create_journal_entries_table.php create mode 100644 database/migrations/2026_02_06_300001_create_journal_entry_lines_table.php diff --git a/database/migrations/2026_02_06_300000_create_journal_entries_table.php b/database/migrations/2026_02_06_300000_create_journal_entries_table.php new file mode 100644 index 0000000..11d1212 --- /dev/null +++ b/database/migrations/2026_02_06_300000_create_journal_entries_table.php @@ -0,0 +1,36 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->string('entry_no', 20)->comment('전표번호 JE-YYYYMMDD-NNN'); + $table->date('entry_date')->comment('전표일자'); + $table->string('entry_type', 20)->default('general')->comment('전표유형'); + $table->string('description', 500)->nullable()->comment('적요'); + $table->bigInteger('total_debit')->default(0)->comment('차변합계'); + $table->bigInteger('total_credit')->default(0)->comment('대변합계'); + $table->string('status', 20)->default('draft')->comment('상태: draft, confirmed'); + $table->string('created_by_name', 100)->nullable()->comment('작성자명'); + $table->text('attachment_note')->nullable()->comment('첨부메모'); + $table->timestamps(); + $table->softDeletes(); + + $table->unique(['tenant_id', 'entry_no']); + $table->index(['tenant_id', 'entry_date']); + $table->index(['tenant_id', 'status']); + }); + } + + public function down(): void + { + Schema::dropIfExists('journal_entries'); + } +}; diff --git a/database/migrations/2026_02_06_300001_create_journal_entry_lines_table.php b/database/migrations/2026_02_06_300001_create_journal_entry_lines_table.php new file mode 100644 index 0000000..84f9faa --- /dev/null +++ b/database/migrations/2026_02_06_300001_create_journal_entry_lines_table.php @@ -0,0 +1,40 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->unsignedBigInteger('journal_entry_id'); + $table->smallInteger('line_no')->comment('행번호'); + $table->string('dc_type', 10)->comment('차대구분: debit/credit'); + $table->string('account_code', 10)->comment('계정코드'); + $table->string('account_name', 100)->comment('계정명'); + $table->unsignedBigInteger('trading_partner_id')->nullable()->comment('거래처ID'); + $table->string('trading_partner_name', 100)->nullable()->comment('거래처명'); + $table->bigInteger('debit_amount')->default(0)->comment('차변금액'); + $table->bigInteger('credit_amount')->default(0)->comment('대변금액'); + $table->string('description', 300)->nullable()->comment('적요'); + $table->timestamps(); + + $table->foreign('journal_entry_id') + ->references('id') + ->on('journal_entries') + ->onDelete('cascade'); + + $table->index(['journal_entry_id', 'line_no']); + $table->index(['tenant_id', 'account_code']); + }); + } + + public function down(): void + { + Schema::dropIfExists('journal_entry_lines'); + } +};