<?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('gmlist', function (Blueprint $table) {
            $table->increments('mID');
            $table->string('mAccount', 30);
            $table->string('mName', 32);
            $table->string('mContactIP', 16)->default('0.0.0.0');
            $table->string('mServerIP', 16)->default('ALL');
            $table->enum('mAuthority', ['IMPLEMENTOR', 'HIGH_WIZARD', 'GOD', 'LOW_WIZARD', 'PLAYER'])->nullable()->default('PLAYER');

            $table->foreign('mAccount')->references('login')->on('account');
            $table->foreign('mName')->references('name')->on('player')->cascadeOnUpdate();
        });
    }

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