bigIncrements('id')->comment('PK'); $table->unsignedBigInteger('tenant_id')->comment('테넌트 ID'); $table->string('group', 50)->comment('분류 그룹 키 (예: product_type, payment_method)'); $table->string('code', 50)->comment('분류 코드 (그룹 내 고유)'); $table->string('name', 100)->comment('분류명'); $table->boolean('is_active')->default(true)->comment('활성여부(1=활성,0=비활성)'); $table->timestamps(); $table->softDeletes()->comment('소프트삭제 시각'); // 고유/검색 인덱스 $table->unique(['tenant_id', 'group', 'code'], 'uniq_tenant_group_code'); // code는 그룹 내 유니크 $table->index(['tenant_id', 'group', 'is_active'], 'idx_tenant_group_active'); // FK (모델링 단계에서 생성, 운영 전 필요 시 제거) $table->foreign('tenant_id') ->references('id')->on('tenants') ->cascadeOnUpdate() ->restrictOnDelete(); }); // 테이블 주석 DB::statement("ALTER TABLE `classifications` COMMENT='분류 관리(코드 테이블; 평면 구조)';"); } public function down(): void { Schema::dropIfExists('classifications'); } };