<?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('users', function (Blueprint $table) {
            // Index for status filtering (commonly used in queries)
            $table->index('status', 'users_status_index');
            
            // Composite index for common filtering combinations
            $table->index(['status', 'name'], 'users_status_name_index');
            
            // Index for soft deletes (if using soft deletes frequently)
            $table->index('deleted_at', 'users_deleted_at_index');
            
            // Index for created_at (for sorting by creation date)
            $table->index('created_at', 'users_created_at_index');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropIndex('users_status_index');
            $table->dropIndex('users_status_name_index');
            $table->dropIndex('users_deleted_at_index');
            $table->dropIndex('users_created_at_index');
        });
    }
};