<?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()
    {
        // TODO Source doesn't seem like it is working
        Schema::create('guild_comment', function (Blueprint $table) {
            $table->unsignedInteger('id', true)->primary();
            $table->unsignedInteger('guild_id');
            $table->string('name', 8)->nullable();
            $table->tinyInteger('notice')->nullable();
            $table->string('content', 50)->nullable();
            $table->dateTime('time')->nullable();

            $table->index(['notice', 'id', 'guild_id'], 'aaa');
            $table->foreign('guild_id')->references('id')->on('guild');
        });
    }

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