From 4c7cf85ef90c5fa13aa2f6a27750a11f80212135 Mon Sep 17 00:00:00 2001 From: pro Date: Thu, 29 Jan 2026 09:00:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=EC=8B=9C=EB=82=98=EB=A6=AC=EC=98=A4=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=9C=A0?= =?UTF-8?q?=EB=8B=88=ED=81=AC=20=ED=82=A4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 기존 유니크 키 (tenant_id, user_id, step_id, checkpoint_index) 삭제 - 새 유니크 키 (tenant_id, scenario_type, step_id, checkpoint_id) 생성 - checkpoint_index를 nullable로 변경 Co-Authored-By: Claude Opus 4.5 --- LOGICAL_RELATIONSHIPS.md | 2 +- ...x_sales_scenario_checklists_unique_key.php | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2026_01_29_090000_fix_sales_scenario_checklists_unique_key.php diff --git a/LOGICAL_RELATIONSHIPS.md b/LOGICAL_RELATIONSHIPS.md index d6211e5..bafc746 100644 --- a/LOGICAL_RELATIONSHIPS.md +++ b/LOGICAL_RELATIONSHIPS.md @@ -1,6 +1,6 @@ # 논리적 데이터베이스 관계 문서 -> **자동 생성**: 2026-01-28 08:49:03 +> **자동 생성**: 2026-01-29 08:59:43 > **소스**: Eloquent 모델 관계 분석 ## 📊 모델별 관계 현황 diff --git a/database/migrations/2026_01_29_090000_fix_sales_scenario_checklists_unique_key.php b/database/migrations/2026_01_29_090000_fix_sales_scenario_checklists_unique_key.php new file mode 100644 index 0000000..fee45fd --- /dev/null +++ b/database/migrations/2026_01_29_090000_fix_sales_scenario_checklists_unique_key.php @@ -0,0 +1,48 @@ +dropUnique('sales_scenario_unique'); + + // checkpoint_index를 nullable로 변경 + $table->unsignedTinyInteger('checkpoint_index')->nullable()->change(); + + // 새 유니크 키 생성 (checkpoint_id 기반) + $table->unique( + ['tenant_id', 'scenario_type', 'step_id', 'checkpoint_id'], + 'sales_scenario_checkpoint_unique' + ); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('sales_scenario_checklists', function (Blueprint $table) { + // 새 유니크 키 삭제 + $table->dropUnique('sales_scenario_checkpoint_unique'); + + // checkpoint_index를 NOT NULL로 복원 + $table->unsignedTinyInteger('checkpoint_index')->nullable(false)->change(); + + // 기존 유니크 키 복원 + $table->unique( + ['tenant_id', 'user_id', 'step_id', 'checkpoint_index'], + 'sales_scenario_unique' + ); + }); + } +};