<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void {
        Schema::dropIfExists('evaluacion_nivel');
        Schema::create('evaluacion_nivel', function (Blueprint $table) {
            $table->unsignedBigInteger('evaluacion_id');
            $table->unsignedBigInteger('nivel_id');
            $table->primary(['evaluacion_id', 'nivel_id']);
            $table->foreign('evaluacion_id')->references('id')->on('evaluaciones')->onDelete('cascade');
            $table->foreign('nivel_id')->references('id')->on('nivels');
        });
    }
    public function down(): void { Schema::dropIfExists('evaluacion_nivel'); }
};
