From d412ae45b74e0badf39daed3df4eee046868dc10 Mon Sep 17 00:00:00 2001 From: pro Date: Fri, 30 Jan 2026 15:17:16 +0900 Subject: [PATCH] =?UTF-8?q?fix:Laravel=2012=20=ED=98=B8=ED=99=98=20-=20Doc?= =?UTF-8?q?trine=20DBAL=20=EB=8C=80=EC=8B=A0=20DB::select=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getDoctrineSchemaManager() 제거 (Laravel 12에서 미지원) - 인덱스 존재 여부 확인을 SHOW INDEX 쿼리로 변경 Co-Authored-By: Claude Opus 4.5 --- ...mns_to_sales_scenario_checklists_table.php | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/database/migrations/2026_01_30_150000_add_missing_columns_to_sales_scenario_checklists_table.php b/database/migrations/2026_01_30_150000_add_missing_columns_to_sales_scenario_checklists_table.php index fd081f3..8c8c9e9 100644 --- a/database/migrations/2026_01_30_150000_add_missing_columns_to_sales_scenario_checklists_table.php +++ b/database/migrations/2026_01_30_150000_add_missing_columns_to_sales_scenario_checklists_table.php @@ -3,6 +3,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; +use Illuminate\Support\Facades\DB; return new class extends Migration { @@ -62,26 +63,27 @@ public function up(): void }); // 인덱스 추가 (이미 존재하면 무시) - Schema::table('sales_scenario_checklists', function (Blueprint $table) { - $sm = Schema::getConnection()->getDoctrineSchemaManager(); - $indexes = $sm->listTableIndexes('sales_scenario_checklists'); - - // UNIQUE KEY 추가 - if (!isset($indexes['sales_scenario_checkpoint_unique'])) { + // UNIQUE KEY 추가 + $uniqueExists = DB::select("SHOW INDEX FROM sales_scenario_checklists WHERE Key_name = 'sales_scenario_checkpoint_unique'"); + if (empty($uniqueExists)) { + Schema::table('sales_scenario_checklists', function (Blueprint $table) { $table->unique( ['tenant_id', 'scenario_type', 'step_id', 'checkpoint_id'], 'sales_scenario_checkpoint_unique' ); - } + }); + } - // INDEX 추가 - if (!isset($indexes['sales_scenario_checklists_tenant_id_scenario_type_index'])) { + // INDEX 추가 + $indexExists = DB::select("SHOW INDEX FROM sales_scenario_checklists WHERE Key_name = 'sales_scenario_checklists_tenant_id_scenario_type_index'"); + if (empty($indexExists)) { + Schema::table('sales_scenario_checklists', function (Blueprint $table) { $table->index( ['tenant_id', 'scenario_type'], 'sales_scenario_checklists_tenant_id_scenario_type_index' ); - } - }); + }); + } } /**