<?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('clients', function (Blueprint $table) {
            $table->string('external_customer_id')->nullable()->after('user_id')->unique();
            $table->string('external_customer_code')->nullable()->after('external_customer_id')->unique();
        });
    }

    public function down(): void
    {
        Schema::table('clients', function (Blueprint $table) {
            $table->dropUnique(['external_customer_id']);
            $table->dropUnique(['external_customer_code']);
            $table->dropColumn([
                'external_customer_id',
                'external_customer_code',
            ]);
        });
    }
};
