"""add_critical_test_audit_indexes

Add missing critical indexes for tests and audit_logs tables to match
model __table_args__ declarations.  Existing indexes (from b005, b018,
b019) are left untouched; only the two genuinely new indexes are created.

Revision ID: b024critidx
Revises: b023mustchgpwd
Create Date: 2026-02-18 12:00:00.000000

"""
from typing import Sequence, Union

from alembic import op

revision: str = "b024critidx"
down_revision: Union[str, None] = "b023mustchgpwd"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.create_index(
        "ix_tests_created_at",
        "tests",
        ["created_at"],
    )
    op.create_index(
        "ix_tests_state_created_at",
        "tests",
        ["state", "created_at"],
    )


def downgrade() -> None:
    op.drop_index("ix_tests_state_created_at", table_name="tests")
    op.drop_index("ix_tests_created_at", table_name="tests")
