<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('sprint_backlogs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('r_id')->constrained('requirements')->onDelete('cascade');
            $table->unsignedBigInteger('nfu_id');
            $table->foreign('nfu_id')
                ->references('id')
                ->on('non_functional_requirements')
                ->onDelete('cascade');
            $table->foreignId('project_id')->constrained('projects')->onDelete('cascade');
            $table->foreignId('sprint_id')->constrained('sprints')->onDelete('cascade');
            $table->string('status')->default('pending');
            $table->timestamps();
        });
    }

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