<?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('marriage', function (Blueprint $table) {
            $table->boolean('is_married')->default(false);
            $table->unsignedInteger('pid1');
            $table->unsignedInteger('pid2');
            $table->unsignedInteger('love_point')->nullable();
            $table->unsignedInteger('time');

            $table->primary(['pid1', 'pid2']);
            $table->foreign('pid1')->references('id')->on('player');
            $table->foreign('pid2')->references('id')->on('player');
        });
    }

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