<?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('board_swimlanes', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('board_id');
            $table->unsignedInteger('swimlane_id');
            $table->string('name')->nullable();
            $table->string('limit')->nullable();
            $table->unsignedInteger('position')->nullable();
            $table->text('description')->nullable();
            $table->timestamps();

            $table->unique(['board_id', 'swimlane_id']);

            $table->foreign('board_id')->references('id')->on('boards')->onUpdate('cascade')->onDelete('cascade');
        });
    }

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