<?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_member', function (Blueprint $table) {
            $table->unsignedInteger('pid');
            $table->unsignedInteger('guild_id');
            $table->tinyInteger('grade');
            $table->boolean('is_general')->default(false);
            $table->unsignedInteger('offer');

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

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