fix:시나리오 체크리스트 유니크 키 수정
- 기존 유니크 키 (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 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 논리적 데이터베이스 관계 문서
|
||||
|
||||
> **자동 생성**: 2026-01-28 08:49:03
|
||||
> **자동 생성**: 2026-01-29 08:59:43
|
||||
> **소스**: Eloquent 모델 관계 분석
|
||||
|
||||
## 📊 모델별 관계 현황
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('sales_scenario_checklists', function (Blueprint $table) {
|
||||
// 기존 유니크 키 삭제
|
||||
$table->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'
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user