From 8ce8a35f30d5d4b4a4d98e471a016aaec65ed891 Mon Sep 17 00:00:00 2001 From: hskwon Date: Mon, 17 Nov 2025 16:41:57 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20is=5Factive=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=EA=B7=B8=EB=A0=88=EC=9D=B4=EC=85=98=EC=97=90=20=EC=BB=AC?= =?UTF-8?q?=EB=9F=BC=20=EC=A1=B4=EC=9E=AC=20=EC=97=AC=EB=B6=80=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Schema::hasColumn()으로 컬럼 존재 여부 확인 - 개발 서버와 로컬 환경의 스키마 차이 대응 - 중복 컬럼 추가 오류 방지 --- ...ctive_to_products_and_materials_tables.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/database/migrations/2025_11_17_145307_add_is_active_to_products_and_materials_tables.php b/database/migrations/2025_11_17_145307_add_is_active_to_products_and_materials_tables.php index 25a4815..5575fba 100644 --- a/database/migrations/2025_11_17_145307_add_is_active_to_products_and_materials_tables.php +++ b/database/migrations/2025_11_17_145307_add_is_active_to_products_and_materials_tables.php @@ -11,20 +11,24 @@ */ public function up(): void { - // products 테이블에 is_active 추가 + // products 테이블에 is_active 추가 (컬럼이 없을 때만) Schema::table('products', function (Blueprint $table) { - $table->tinyInteger('is_active') - ->default(1) - ->after('updated_by') - ->comment('활성 상태 (1: 활성, 0: 비활성)'); + if (! Schema::hasColumn('products', 'is_active')) { + $table->tinyInteger('is_active') + ->default(1) + ->after('updated_by') + ->comment('활성 상태 (1: 활성, 0: 비활성)'); + } }); - // materials 테이블에 is_active 추가 + // materials 테이블에 is_active 추가 (컬럼이 없을 때만) Schema::table('materials', function (Blueprint $table) { - $table->tinyInteger('is_active') - ->default(1) - ->after('updated_by') - ->comment('활성 상태 (1: 활성, 0: 비활성)'); + if (! Schema::hasColumn('materials', 'is_active')) { + $table->tinyInteger('is_active') + ->default(1) + ->after('updated_by') + ->comment('활성 상태 (1: 활성, 0: 비활성)'); + } }); }