feat: [approval] 연차사용촉진 통지서 1차/2차 양식 마이그레이션 추가
- leave_promotion_1st: 연차사용촉진 통지서 (1차) - hr 카테고리 - leave_promotion_2nd: 연차사용촉진 통지서 (2차) - hr 카테고리
This commit is contained in:
@@ -0,0 +1,60 @@
|
|||||||
|
<?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) {
|
||||||
|
// 1차 통지서
|
||||||
|
$exists1st = DB::table('approval_forms')
|
||||||
|
->where('tenant_id', $tenantId)
|
||||||
|
->where('code', 'leave_promotion_1st')
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if (! $exists1st) {
|
||||||
|
DB::table('approval_forms')->insert([
|
||||||
|
'tenant_id' => $tenantId,
|
||||||
|
'name' => '연차사용촉진 통지서 (1차)',
|
||||||
|
'code' => 'leave_promotion_1st',
|
||||||
|
'category' => 'hr',
|
||||||
|
'template' => '[]',
|
||||||
|
'body_template' => '',
|
||||||
|
'is_active' => true,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2차 통지서
|
||||||
|
$exists2nd = DB::table('approval_forms')
|
||||||
|
->where('tenant_id', $tenantId)
|
||||||
|
->where('code', 'leave_promotion_2nd')
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if (! $exists2nd) {
|
||||||
|
DB::table('approval_forms')->insert([
|
||||||
|
'tenant_id' => $tenantId,
|
||||||
|
'name' => '연차사용촉진 통지서 (2차)',
|
||||||
|
'code' => 'leave_promotion_2nd',
|
||||||
|
'category' => 'hr',
|
||||||
|
'template' => '[]',
|
||||||
|
'body_template' => '',
|
||||||
|
'is_active' => true,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
DB::table('approval_forms')->where('code', 'leave_promotion_1st')->delete();
|
||||||
|
DB::table('approval_forms')->where('code', 'leave_promotion_2nd')->delete();
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user