"""Drop legacy content_type tags from the 6-category classifier

Revision ID: 0013_drop_old_ct
Revises: 0012_strip_ai
Create Date: 2026-04-14

The previous classifier wrote Tag(kind='content_type', name IN
('photograph','screenshot','document','receipt','meme','artwork')).
The new binary classifier writes names ('photography','other'). Both
coexisted after the cutover so users saw duplicate groupings like
'photography' alongside 'photograph'. Drop the old names — photo_tags
rows cascade-delete via the FK.
"""
from typing import Sequence, Union

from alembic import op

revision: str = "0013_drop_old_ct"
down_revision: Union[str, None] = "0012_strip_ai"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


LEGACY_NAMES = ('photograph', 'screenshot', 'document', 'receipt', 'meme', 'artwork')


def upgrade() -> None:
    op.execute(
        "DELETE FROM tags WHERE kind = 'content_type' "
        f"AND name IN {LEGACY_NAMES}"
    )


def downgrade() -> None:
    pass
