<?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_war_bet', function (Blueprint $table) {
            $table->string('login', 30);
            $table->unsignedInteger('gold');
            $table->unsignedInteger('guild');
            $table->unsignedInteger('war_id');

            $table->primary(['war_id', 'login']);
            $table->foreign('login')->references('login')->on('account');
            $table->foreign('guild')->references('id')->on('guild');
            $table->foreign('war_id')->references('id')->on('guild_war_reservation');
        });
    }

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