KTV/database/migrations/2025_04_23_031630_create_songs_table.php

50 lines
2.0 KiB
PHP
Raw Normal View History

2025-04-25 09:33:28 +08:00
<?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('songs', function (Blueprint $table) {
$table->bigIncrements('id')->comment('歌曲編號');
$table->text('name')->nullable()->comment('歌曲檔名');
$table->string('filename')->comment('歌曲檔名');
$table->date('adddate')->comment('新增日期');
$table->unsignedBigInteger('language_type')->comment('語別'); // 關聯 song_languages.id
$table->integer('db_change')->default(0)->comment('DB加減');
$table->tinyInteger('vocal')->comment('人聲'); // 0,1
$table->string('situation')->comment('情境');
$table->string('copyright01')->nullable()->comment('版權01');
$table->string('copyright02')->nullable()->comment('版權02');
$table->string('note01')->nullable()->comment('備註01');
$table->string('note02')->nullable()->comment('備註02');
$table->string('note03')->nullable()->comment('備註03');
$table->string('note04')->nullable()->comment('備註04');
$table->tinyInteger('enable')->default(1)->comment('狀態'); // 1,可看0,不可看
$table->float('unnamed_21')->nullable()->comment('Unnamed_21');
$table->string('simplified')->comment('歌名簡體');
$table->string('phonetic_abbr')->comment('歌曲注音');
$table->string('pinyin_abbr')->comment('歌曲拼音');
$table->timestamps();
// 外鍵關聯(如有需要)
$table->foreign('language_type')->references('id')->on('song_languages')->restrictOnDelete()->restrictOnUpdate();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('songs');
}
};