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: 비활성)'); + } }); }