<?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('proceso_admision_resultado_archivos', function (Blueprint $table) {
            $table->id();
            $table->foreignId('proceso_admision_id')
                  ->constrained('procesos_admision')
                  ->onDelete('cascade');
            $table->string('nombre');
            $table->string('file_path');
            $table->unsignedTinyInteger('orden');
            $table->timestamps();

            $table->unique(['proceso_admision_id', 'orden'], 'uniq_proceso_orden');
        });
    }

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