Files
sam-api/database/migrations/2025_07_28_183747_create_lots_table.php

35 lines
1.5 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('lots', function (Blueprint $table) {
$table->id()->comment('로트관리 PK');
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
$table->string('lot_number', 30)->unique()->comment('로트번호');
$table->unsignedBigInteger('material_id')->comment('자재ID');
$table->string('specification', 100)->nullable()->comment('규격');
$table->string('length', 20)->nullable()->comment('길이');
$table->integer('quantity')->comment('수량');
$table->string('raw_lot_number', 30)->nullable()->comment('원자재 로트번호');
$table->string('fabric_lot', 30)->nullable()->comment('원단 로트');
$table->string('author', 50)->nullable()->comment('작성자');
$table->text('remarks')->nullable()->comment('비고');
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
$table->timestamps();
$table->softDeletes();
$table->index('material_id', 'idx_lots_material_id');
});
}
public function down(): void
{
Schema::dropIfExists('lots');
}
};