diff --git a/database/migrations/2026_02_28_100005_add_parent_id_to_interview_categories_table.php b/database/migrations/2026_02_28_100005_add_parent_id_to_interview_categories_table.php new file mode 100644 index 0000000..8b926b8 --- /dev/null +++ b/database/migrations/2026_02_28_100005_add_parent_id_to_interview_categories_table.php @@ -0,0 +1,26 @@ +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'); + }); + } +};