Files
sam-api/database/migrations/2025_12_17_130000_create_deposits_table.php

41 lines
1.9 KiB
PHP
Raw Permalink Normal View History

<?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('deposits', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->date('deposit_date')->comment('입금일');
$table->unsignedBigInteger('client_id')->nullable()->comment('거래처 ID');
$table->string('client_name', 100)->nullable()->comment('비회원 거래처명');
$table->unsignedBigInteger('bank_account_id')->nullable()->comment('입금 계좌 ID');
$table->decimal('amount', 15, 2)->comment('금액');
$table->string('payment_method', 20)->comment('결제수단: cash/transfer/card/check');
$table->string('account_code', 20)->nullable()->comment('계정과목');
$table->text('description')->nullable()->comment('적요');
$table->string('reference_type', 50)->nullable()->comment('참조 유형: sales/receivable/etc');
$table->unsignedBigInteger('reference_id')->nullable()->comment('참조 ID');
$table->unsignedBigInteger('created_by')->nullable()->comment('생성자 ID');
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자 ID');
$table->unsignedBigInteger('deleted_by')->nullable()->comment('삭제자 ID');
$table->softDeletes();
$table->timestamps();
$table->index(['tenant_id', 'deposit_date'], 'idx_tenant_date');
$table->index('client_id', 'idx_client');
$table->index('payment_method', 'idx_payment_method');
});
}
public function down(): void
{
Schema::dropIfExists('deposits');
}
};