feat: [approval] Phase 2 마이그레이션 추가

- approval_steps: parallel_group, acted_by, approval_type 컬럼 추가
- approvals: recall_reason, parent_doc_id 컬럼 추가
- approval_delegations 테이블 생성 (위임/대결)
This commit is contained in:
김보곤
2026-02-27 23:41:34 +09:00
parent b80f4a0392
commit bfb821698a
3 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?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('approval_steps', function (Blueprint $table) {
$table->integer('parallel_group')->nullable()->after('step_type')
->comment('병렬 그룹 번호');
$table->foreignId('acted_by')->nullable()->after('approver_id')
->comment('실제 처리자 (대결)');
$table->string('approval_type', 20)->default('normal')->after('status')
->comment('결재 유형: normal/pre_decided/delegated');
});
}
public function down(): void
{
Schema::table('approval_steps', function (Blueprint $table) {
$table->dropColumn(['parallel_group', 'acted_by', 'approval_type']);
});
}
};

View File

@@ -0,0 +1,25 @@
<?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('approvals', function (Blueprint $table) {
$table->text('recall_reason')->nullable()->after('completed_at')
->comment('회수 사유');
$table->foreignId('parent_doc_id')->nullable()->after('recall_reason')
->comment('재기안 원본 문서');
});
}
public function down(): void
{
Schema::table('approvals', function (Blueprint $table) {
$table->dropColumn(['recall_reason', 'parent_doc_id']);
});
}
};

View File

@@ -0,0 +1,34 @@
<?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('approval_delegations', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->onDelete('cascade');
$table->foreignId('delegator_id')->constrained('users')->comment('위임자');
$table->foreignId('delegate_id')->constrained('users')->comment('대리인');
$table->date('start_date')->comment('시작일');
$table->date('end_date')->comment('종료일');
$table->json('form_ids')->nullable()->comment('위임 대상 양식 (NULL=전체)');
$table->boolean('notify_delegator')->default(true)->comment('대결 시 보고');
$table->boolean('is_active')->default(true);
$table->string('reason', 200)->nullable()->comment('위임 사유');
$table->foreignId('created_by')->nullable()->constrained('users');
$table->softDeletes();
$table->timestamps();
$table->index(['tenant_id', 'delegator_id', 'is_active']);
});
}
public function down(): void
{
Schema::dropIfExists('approval_delegations');
}
};