KTV/database/migrations/2025_05_06_055307_create_rooms_table.php

35 lines
1.1 KiB
PHP

<?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
{
Schema::create('rooms', function (Blueprint $table) {
$table->id();
$table->foreignId('branch_id')->constrained()->onDelete('cascade'); // 關聯分店
$table->string('name'); // 包廂名稱
$table->string('internal_ip'); // 內部 IP
$table->unsignedSmallInteger('port'); // 通訊 Port
$table->enum('status', ['active', 'closed', 'error', 'maintenance']); // 狀態:啟用中 / 已結束
$table->dateTime('started_at'); // 開始時間
$table->dateTime('ended_at')->nullable(); // 結束時間
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rooms');
}
};