Files
sam-api/database/migrations/2025_09_05_000001_create_models_table.php
hskwon cc206fdbed style: Laravel Pint 코드 포맷팅 적용
- PSR-12 스타일 가이드 준수
- 302개 파일 스타일 이슈 자동 수정
- 코드 로직 변경 없음 (포맷팅만)
2025-11-06 17:45:49 +09:00

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');
}
};