feat: [approval] 위촉증명서 양식 데이터 마이그레이션

This commit is contained in:
김보곤
2026-03-05 23:57:45 +09:00
parent 78eb9363f4
commit 92efe2e83b

View File

@@ -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', 'appointment_cert')
->exists();
if (! $exists) {
DB::table('approval_forms')->insert([
'tenant_id' => $tenantId,
'name' => '위촉증명서',
'code' => 'appointment_cert',
'category' => 'certificate',
'template' => '[]',
'body_template' => '',
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}
public function down(): void
{
DB::table('approval_forms')->where('code', 'appointment_cert')->delete();
}
};