<?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::table('registros_salidas', function (Blueprint $table) {
            // Se agrega turno (relación con tabla turnos)
            $table->unsignedInteger('id_turno')->nullable()->after('id_usuario');

            $table->foreign('id_turno')->references('id_turno')->on('turnos')->nullOnDelete();
        });
    }

    public function down(): void
    {
        Schema::table('registros_salidas', function (Blueprint $table) {
            $table->dropForeign(['id_turno']);
            $table->dropColumn('id_turno');
        });
    }
};

