Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('barobill_bank_transaction_overrides', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
|
||||
$table->string('unique_key', 100)->comment('거래 고유키 (계좌번호|거래일시|입금|출금|잔액)');
|
||||
$table->string('modified_summary', 200)->nullable()->comment('수정된 적요');
|
||||
$table->string('modified_cast', 200)->nullable()->comment('수정된 내용');
|
||||
$table->timestamps();
|
||||
|
||||
// 복합 유니크 인덱스 (테넌트별 거래 고유키)
|
||||
$table->unique(['tenant_id', 'unique_key'], 'bb_trans_override_unique');
|
||||
|
||||
// 조회용 인덱스
|
||||
$table->index('tenant_id', 'bb_trans_override_tenant_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('barobill_bank_transaction_overrides');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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('barobill_bank_transactions', function (Blueprint $table) {
|
||||
$table->boolean('is_manual')->default(false)
|
||||
->after('account_name')
|
||||
->comment('수동 입력 여부');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('barobill_bank_transactions', function (Blueprint $table) {
|
||||
$table->dropColumn('is_manual');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
* 계좌 입출금 거래 분개 테이블 - 하나의 입출금 거래를 여러 계정과목으로 분개
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('barobill_bank_transaction_splits', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->onDelete('cascade');
|
||||
|
||||
// 원본 거래 고유키 (바로빌에서 가져온 원본 데이터 식별)
|
||||
$table->string('original_unique_key', 200)->comment('원본 거래 고유키 (bankAccountNum|transDt|deposit|withdraw|balance)');
|
||||
|
||||
// 분개 정보
|
||||
$table->decimal('split_amount', 18, 2)->comment('분개 금액');
|
||||
$table->string('account_code', 50)->nullable()->comment('계정과목 코드');
|
||||
$table->string('account_name', 100)->nullable()->comment('계정과목명');
|
||||
$table->string('description', 255)->nullable()->comment('분개 내역');
|
||||
$table->string('memo', 255)->nullable()->comment('분개 메모');
|
||||
$table->integer('sort_order')->default(0)->comment('정렬 순서');
|
||||
|
||||
// 원본 거래 정보 (조회 편의를 위해 저장)
|
||||
$table->string('bank_account_num', 50)->comment('계좌번호');
|
||||
$table->string('trans_dt', 20)->comment('거래일시 (YYYYMMDDHHMMSS)');
|
||||
$table->string('trans_date', 8)->comment('거래일 (YYYYMMDD)');
|
||||
$table->decimal('original_deposit', 18, 2)->default(0)->comment('원본 입금액');
|
||||
$table->decimal('original_withdraw', 18, 2)->default(0)->comment('원본 출금액');
|
||||
$table->string('summary', 255)->nullable()->comment('원본 적요');
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// 인덱스
|
||||
$table->index(['tenant_id', 'original_unique_key'], 'bb_bank_split_tenant_key_idx');
|
||||
$table->index(['tenant_id', 'trans_date'], 'bb_bank_split_tenant_date_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('barobill_bank_transaction_splits');
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
{
|
||||
Schema::create('journal_entries', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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::create('journal_entry_lines', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user