<?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('credit_inquiries', function (Blueprint $table) {
            $table->unsignedBigInteger('tenant_id')->nullable()->after('id');
            $table->index('tenant_id');
            $table->index(['tenant_id', 'inquired_at']);
        });
    }

    public function down(): void
    {
        Schema::table('credit_inquiries', function (Blueprint $table) {
            $table->dropIndex(['tenant_id', 'inquired_at']);
            $table->dropIndex(['tenant_id']);
            $table->dropColumn('tenant_id');
        });
    }
};
