feat: [approvals] 사용인감계 양식 데이터 마이그레이션 추가
- 모든 테넌트에 seal_usage 양식 자동 등록
This commit is contained in:
@@ -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', 'seal_usage')
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if (! $exists) {
|
||||||
|
DB::table('approval_forms')->insert([
|
||||||
|
'tenant_id' => $tenantId,
|
||||||
|
'name' => '사용인감계',
|
||||||
|
'code' => 'seal_usage',
|
||||||
|
'category' => 'certificate',
|
||||||
|
'template' => '[]',
|
||||||
|
'body_template' => '',
|
||||||
|
'is_active' => true,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
DB::table('approval_forms')->where('code', 'seal_usage')->delete();
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user