<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('guild_grade', function (Blueprint $table) {
            $table->unsignedInteger('guild_id');
            $table->tinyInteger('grade');
            $table->string('name', 8);
            $table->set('auth', ['ADD_MEMBER', 'REMOVE_MEMEBER', 'NOTICE', 'USE_SKILL'])->nullable();

            $table->primary(['guild_id', 'grade']);
            $table->foreign('guild_id')->references('id')->on('guild');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('guild_grade');
    }
};
