feat: [interview] 카테고리 계층 구조 parent_id 마이그레이션 추가

- interview_categories 테이블에 parent_id 컬럼 추가
- self-referencing FK, nullOnDelete
This commit is contained in:
김보곤
2026-02-28 21:23:19 +09:00
parent 7028e27517
commit 93e94901b7

View File

@@ -0,0 +1,26 @@
<?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('interview_categories', function (Blueprint $table) {
$table->unsignedBigInteger('parent_id')->nullable()->after('interview_project_id')->comment('부모 카테고리 ID (대분류→중분류)');
$table->index('parent_id', 'idx_interview_categories_parent');
$table->foreign('parent_id')->references('id')->on('interview_categories')->nullOnDelete();
});
}
public function down(): void
{
Schema::table('interview_categories', function (Blueprint $table) {
$table->dropForeign(['parent_id']);
$table->dropIndex('idx_interview_categories_parent');
$table->dropColumn('parent_id');
});
}
};