KTV/database/migrations/2025_05_06_055307_create_rooms_table.php
allen.yan 3bbb1a5cc0 Room 加入 is_online 來區別再不再線上
調整 FavoriteSongs 資料塞值改用seeder
加入 user_song table
/api/room/receiveRegister 調整邏輯
room介面 開關包帳功能調整
寫入心跳封包
20250522
2025-05-22 10:08:34 +08:00

38 lines
1.4 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')->comment('關聯分店');
$table->unsignedTinyInteger('floor')->default(1)->comment('樓層'); // 可根據實際狀況決定預設值
$table->enum('type',['unset', 'pc','svr'])->default('unset')->comment('包廂類別');
$table->string('name')->comment('包廂名稱');
$table->string('internal_ip')->nullable()->comment('內部 IP');
$table->unsignedSmallInteger('port')->nullable()->comment('通訊 Port');
$table->tinyInteger('is_online')->default(0)->comment('連線狀態');
$table->enum('status', ['active', 'closed','fire', 'error'])->default('error')->comment('狀態'); // :啟用中 / 已結束
$table->dateTime('started_at')->nullable()->comment('開始時間'); //
$table->dateTime('ended_at')->nullable()->comment('結束時間'); //
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rooms');
}
};