feat: [결재] 양식 마이그레이션 12종 + 반려이력/재상신
- 재직/경력/위촉증명서, 사직서, 사용인감계, 위임장 - 이사회의사록, 견적서, 공문서, 연차사용촉진 1차/2차 - 지출결의서 body_template 고도화 - rejection_history, resubmit_count, drafter_read_at 컬럼 - Document-Approval 브릿지 연동 (linkable) - 수신함 날짜 범위 필터 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 결재(approvals) 테이블에 연결 대상(linkable) 컬럼 추가
|
||||
* - Document 시스템과 Approval 시스템을 브릿지하기 위한 다형성 관계
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('approvals', function (Blueprint $table) {
|
||||
$table->string('linkable_type')->nullable()->after('attachments')->comment('연결 대상 모델 (예: App\\Models\\Documents\\Document)');
|
||||
$table->unsignedBigInteger('linkable_id')->nullable()->after('linkable_type')->comment('연결 대상 ID');
|
||||
$table->index(['linkable_type', 'linkable_id'], 'idx_linkable');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('approvals', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_linkable');
|
||||
$table->dropColumn(['linkable_type', 'linkable_id']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$tenants = DB::table('tenants')->whereNull('deleted_at')->pluck('id');
|
||||
|
||||
foreach ($tenants as $tenantId) {
|
||||
$exists = DB::table('approval_forms')
|
||||
->where('tenant_id', $tenantId)
|
||||
->where('code', 'resignation')
|
||||
->exists();
|
||||
|
||||
if (! $exists) {
|
||||
DB::table('approval_forms')->insert([
|
||||
'tenant_id' => $tenantId,
|
||||
'name' => '사직서',
|
||||
'code' => 'resignation',
|
||||
'category' => 'certificate',
|
||||
'template' => '[]',
|
||||
'body_template' => '',
|
||||
'is_active' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('approval_forms')->where('code', 'resignation')->delete();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user