<?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('tbl_order_details', function (Blueprint $table) {
            if (! Schema::hasColumn('tbl_order_details', 'product_remote_id')) {
                $table->unsignedInteger('product_remote_id')
                    ->nullable()
                    ->index()
                    ->after('order_reference');
            }
        });
    }

    public function down(): void
    {
        // Intencionalmente no hacemos drop para evitar pérdida de datos.
    }
};
