feat: products 및 materials 테이블에 is_active 컬럼 추가

- is_active 컬럼 추가 마이그레이션 (default 1)
- Product 모델 fillable 및 casts 업데이트
- Material 모델 fillable 및 casts 업데이트
- Material 모델에 material_type fillable 추가
- ModelTrait의 scopeActive() 메서드 지원
This commit is contained in:
2025-11-17 14:55:31 +09:00
parent 7b8f8791c9
commit 517d5940e9
3 changed files with 51 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
<?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
{
// products 테이블에 is_active 추가
Schema::table('products', function (Blueprint $table) {
$table->tinyInteger('is_active')
->default(1)
->after('updated_by')
->comment('활성 상태 (1: 활성, 0: 비활성)');
});
// materials 테이블에 is_active 추가
Schema::table('materials', function (Blueprint $table) {
$table->tinyInteger('is_active')
->default(1)
->after('updated_by')
->comment('활성 상태 (1: 활성, 0: 비활성)');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// products 테이블에서 is_active 제거
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('is_active');
});
// materials 테이블에서 is_active 제거
Schema::table('materials', function (Blueprint $table) {
$table->dropColumn('is_active');
});
}
};