35 lines
1.1 KiB
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('artists', function (Blueprint $table) {
|
|||
|
$table->bigIncrements('id');
|
|||
|
$table->unsignedBigInteger('category_id')->default(1)->comment('關聯 artist_category.id');//預設為 1(未定義))
|
|||
|
$table->string('name')->comment('歌星名稱');
|
|||
|
$table->string('simplified')->comment('歌星簡體');
|
|||
|
$table->string('phonetic_abbr')->comment('歌星注音');
|
|||
|
$table->string('pinyin_abbr')->comment('歌星拼音');
|
|||
|
$table->timestamps();
|
|||
|
// 外鍵(如需要)
|
|||
|
$table->foreign('category_id')->references('id')->on('artist_categories')->restrictOnDelete()->restrictOnUpdate();
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* Reverse the migrations.
|
|||
|
*/
|
|||
|
public function down(): void
|
|||
|
{
|
|||
|
Schema::dropIfExists('artists');
|
|||
|
}
|
|||
|
};
|