<?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::table('member_cards', function (Blueprint $table) {
            $table->unsignedBigInteger('discipline1_id')->nullable();
            $table->foreign('discipline1_id')->nullable()->references('id')->on('disciplines')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('discipline2_id')->nullable();
            $table->foreign('discipline2_id')->nullable()->references('id')->on('disciplines')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('discipline3_id')->nullable();
            $table->foreign('discipline3_id')->nullable()->references('id')->on('disciplines')->onUpdate('cascade')->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('member_cards', function (Blueprint $table) {
            $table->dropColumn('discipline1_id');
            $table->dropColumn('discipline2_id');
            $table->dropColumn('discipline3_id');
        });
    }
};
