<?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('preguntas', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('evaluacion_id');
            $table->unsignedBigInteger('pregunta_tipo_id');
            $table->text('texto');
            $table->unsignedSmallInteger('orden')->default(0);
            $table->boolean('requerida')->default(true);
            $table->timestamps();
            $table->foreign('evaluacion_id')->references('id')->on('evaluaciones')->onDelete('cascade');
            $table->foreign('pregunta_tipo_id')->references('id')->on('pregunta_tipos');
        });
    }
    public function down(): void { Schema::dropIfExists('preguntas'); }
};
