<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('detalle_compras', function (Blueprint $table) {
            // Hacer nullable la columna variante_id si no lo es ya
            $table->unsignedBigInteger('variante_id')->nullable()->change();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('detalle_compras', function (Blueprint $table) {
            // Revertir a NOT NULL (solo si no hay registros con NULL)
            $table->unsignedBigInteger('variante_id')->nullable(false)->change();
        });
    }
};
