feat: [hr] 사업소득자 임금대장 테이블 마이그레이션 추가

- business_income_payments 테이블 생성
- 소득세(3%)/지방소득세(0.3%) 고정세율 구조
- (tenant_id, user_id, pay_year, pay_month) 유니크 제약
This commit is contained in:
김보곤
2026-02-27 20:21:59 +09:00
parent 347d351d9d
commit 2ed90dc6db

View File

@@ -0,0 +1,44 @@
<?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('business_income_payments', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained('tenants')->comment('테넌트');
$table->foreignId('user_id')->constrained('users')->comment('사업소득자 사용자');
$table->unsignedSmallInteger('pay_year')->comment('급여 연도');
$table->unsignedTinyInteger('pay_month')->comment('급여 월 (1-12)');
$table->string('service_content', 200)->nullable()->comment('용역내용');
$table->decimal('gross_amount', 15, 0)->default(0)->comment('지급총액');
$table->decimal('income_tax', 15, 0)->default(0)->comment('소득세 (3%)');
$table->decimal('local_income_tax', 15, 0)->default(0)->comment('지방소득세 (0.3%)');
$table->decimal('total_deductions', 15, 0)->default(0)->comment('공제합계');
$table->decimal('net_amount', 15, 0)->default(0)->comment('실지급액');
$table->date('payment_date')->nullable()->comment('지급일자');
$table->text('note')->nullable()->comment('비고');
$table->string('status', 20)->default('draft')->comment('상태: draft/confirmed/paid');
$table->timestamp('confirmed_at')->nullable()->comment('확정일시');
$table->foreignId('confirmed_by')->nullable()->constrained('users')->comment('확정자');
$table->timestamp('paid_at')->nullable()->comment('지급일시');
$table->foreignId('created_by')->nullable()->constrained('users')->comment('생성자');
$table->foreignId('updated_by')->nullable()->constrained('users')->comment('수정자');
$table->foreignId('deleted_by')->nullable()->constrained('users')->comment('삭제자');
$table->timestamps();
$table->softDeletes();
$table->unique(['tenant_id', 'user_id', 'pay_year', 'pay_month'], 'bip_tenant_user_period_unique');
$table->index(['tenant_id', 'pay_year', 'pay_month'], 'bip_tenant_period_idx');
});
}
public function down(): void
{
Schema::dropIfExists('business_income_payments');
}
};