<?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('concurso_respuestas', function (Blueprint $table) {
            $table->id();
            $table->foreignId('participante_id')
                  ->constrained('concurso_participantes')
                  ->cascadeOnDelete();
            $table->unsignedTinyInteger('pregunta_numero');
            $table->string('respuesta_alumno')->nullable(); // null = no respondió
            $table->unique(['participante_id', 'pregunta_numero']);
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('concurso_respuestas');
    }
};
