<?php

declare(strict_types=1);

use App\Infrastructure\Db\Migrations\BaseMigration;

/**
 * SPEC §M12: the audit page filters heavily by `action`. M02's audit_log
 * migration covered created_at, (actor_kind, actor_id), and
 * (target_type, target_id) but not action — fix here.
 */
final class AddAuditActionIndex extends BaseMigration
{
    public function up(): void
    {
        $this->table('audit_log')
            ->addIndex(['action'], ['name' => 'idx_audit_action'])
            ->update();
    }

    public function down(): void
    {
        $this->table('audit_log')
            ->removeIndexByName('idx_audit_action')
            ->update();
    }
}
