"""Add indexes for media browser filtering.

Revision ID: 052
Revises: 051
"""
from alembic import op

revision = "052"
down_revision = "051"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # Index for filtering media_assets by asset_type + created_at ordering
    op.create_index(
        "ix_media_assets_asset_type_created",
        "media_assets",
        ["asset_type", "created_at"],
    )
    # Index for filtering products by category + lagertyp
    op.create_index(
        "ix_products_category_lagertyp",
        "products",
        ["category_key", "lagertyp"],
    )


def downgrade() -> None:
    op.drop_index("ix_products_category_lagertyp", table_name="products")
    op.drop_index("ix_media_assets_asset_type_created", table_name="media_assets")
