<?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::create('assessment_results', function (Blueprint $table) {
            $table->id();
            $table->foreignId('assessment_id')->constrained('assessments')->cascadeOnDelete();
            $table->foreignId('enrollment_id')->constrained('enrollments')->cascadeOnDelete();
            $table->decimal('score', 5, 2)->nullable();
            $table->string('result')->nullable();
            $table->text('note')->nullable();
            $table->timestamps();
            $table->unique(['assessment_id','enrollment_id']);
        });
    }
    public function down(): void { Schema::dropIfExists('assessment_results'); }
};
