Files
sam-api/database/migrations/2025_12_17_130001_create_withdrawals_table.php
hskwon 17799c47de feat: 2.4 입금/출금 관리 API 구현
- 마이그레이션: deposits, withdrawals 테이블 생성
- 모델: Deposit, Withdrawal (BelongsToTenant, SoftDeletes)
- 서비스: DepositService, WithdrawalService (CRUD + summary)
- 컨트롤러: DepositController, WithdrawalController
- FormRequest: Store/Update 검증 클래스
- Swagger: 입금/출금 API 문서 (12개 엔드포인트)
- 라우트: /v1/deposits, /v1/withdrawals 등록
2025-12-17 21:47:15 +09:00

41 lines
1.9 KiB
PHP

<?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('withdrawals', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->date('withdrawal_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('참조 유형: purchase/payable/payroll/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', 'withdrawal_date'], 'idx_tenant_date');
$table->index('client_id', 'idx_client');
$table->index('payment_method', 'idx_payment_method');
});
}
public function down(): void
{
Schema::dropIfExists('withdrawals');
}
};