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:
@@ -24,6 +24,7 @@ class Material extends Model
|
|||||||
'item_name',
|
'item_name',
|
||||||
'specification',
|
'specification',
|
||||||
'material_code',
|
'material_code',
|
||||||
|
'material_type',
|
||||||
'unit',
|
'unit',
|
||||||
'is_inspection',
|
'is_inspection',
|
||||||
'search_tag',
|
'search_tag',
|
||||||
@@ -32,11 +33,13 @@ class Material extends Model
|
|||||||
'options',
|
'options',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_by',
|
'updated_by',
|
||||||
|
'is_active',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'attributes' => 'array',
|
'attributes' => 'array',
|
||||||
'options' => 'array',
|
'options' => 'array',
|
||||||
|
'is_active' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Product extends Model
|
|||||||
'specification_file', 'specification_file_name',
|
'specification_file', 'specification_file_name',
|
||||||
'certification_file', 'certification_file_name',
|
'certification_file', 'certification_file_name',
|
||||||
'certification_number', 'certification_start_date', 'certification_end_date',
|
'certification_number', 'certification_start_date', 'certification_end_date',
|
||||||
'created_by', 'updated_by',
|
'created_by', 'updated_by', 'is_active',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -41,6 +41,7 @@ class Product extends Model
|
|||||||
'is_purchasable' => 'boolean',
|
'is_purchasable' => 'boolean',
|
||||||
'is_producible' => 'boolean',
|
'is_producible' => 'boolean',
|
||||||
'is_variable_size' => 'boolean',
|
'is_variable_size' => 'boolean',
|
||||||
|
'is_active' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|||||||
@@ -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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user