<?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('menus', function (Blueprint $table) {
            // deleted_at 단일 인덱스 추가 (SoftDeletes 쿼리 최적화)
            $table->index('deleted_at', 'menus_deleted_at_idx');

            // tenant_id + deleted_at 복합 인덱스 추가 (멀티테넌트 + SoftDeletes 최적화)
            $table->index(['tenant_id', 'deleted_at'], 'menus_tenant_deleted_idx');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('menus', function (Blueprint $table) {
            // 인덱스 제거 (역순)
            $table->dropIndex('menus_tenant_deleted_idx');
            $table->dropIndex('menus_deleted_at_idx');
        });
    }
};
