35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
// 설계 상위: models
|
|
public function up(): void
|
|
{
|
|
Schema::create('models', function (Blueprint $table) {
|
|
$table->bigIncrements('id');
|
|
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
|
|
$table->string('code', 100)->comment('모델코드(설계코드)');
|
|
$table->string('name', 200)->comment('모델명');
|
|
$table->unsignedBigInteger('category_id')->nullable()->comment('카테고리ID(참조용, FK 미설정)');
|
|
$table->string('lifecycle', 30)->nullable()->comment('PLANNING/ACTIVE/DEPRECATED 등');
|
|
$table->text('description')->nullable();
|
|
$table->boolean('is_active')->default(true);
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->unique(['tenant_id', 'code'], 'uq_models_tenant_code');
|
|
$table->index(['tenant_id', 'is_active'], 'idx_models_tenant_active');
|
|
$table->index(['tenant_id', 'category_id'], 'idx_models_tenant_category');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('models');
|
|
}
|
|
};
|