"""drop dead tagger/suggestion settings + columns left after Camie retirement (#1199)

Hygiene follow-up to #1189. These were left inert to bound that change; nothing
reads them now:
- ml_settings: tagger_store_floor + tagger_model_version (only the deleted Camie
  tagger used them), suggestion_threshold_character/general (already dead pre-
  retirement — scoring uses per-head thresholds), video_min_tag_frames (only the
  deleted video-prediction aggregator used it).
- image_record: tagger_model_version (no writer now), centroid_scores (long-dead
  JSON cache, no reader).

Revision ID: 0068
Revises: 0067
Create Date: 2026-06-30
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

revision: str = "0068"
down_revision: Union[str, None] = "0067"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.drop_column("ml_settings", "suggestion_threshold_character")
    op.drop_column("ml_settings", "suggestion_threshold_general")
    op.drop_column("ml_settings", "tagger_store_floor")
    op.drop_column("ml_settings", "video_min_tag_frames")
    op.drop_column("ml_settings", "tagger_model_version")
    op.drop_column("image_record", "tagger_model_version")
    op.drop_column("image_record", "centroid_scores")


def downgrade() -> None:
    op.add_column(
        "image_record",
        sa.Column("centroid_scores", sa.JSON(), nullable=True),
    )
    op.add_column(
        "image_record",
        sa.Column("tagger_model_version", sa.String(length=128), nullable=True),
    )
    op.add_column(
        "ml_settings",
        sa.Column(
            "tagger_model_version", sa.String(length=128), nullable=False,
            server_default="camie-tagger-v2",
        ),
    )
    op.add_column(
        "ml_settings",
        sa.Column(
            "video_min_tag_frames", sa.Integer(), nullable=False,
            server_default="3",
        ),
    )
    op.add_column(
        "ml_settings",
        sa.Column(
            "tagger_store_floor", sa.Float(), nullable=False,
            server_default="0.7",
        ),
    )
    op.add_column(
        "ml_settings",
        sa.Column(
            "suggestion_threshold_general", sa.Float(), nullable=False,
            server_default="0.7",
        ),
    )
    op.add_column(
        "ml_settings",
        sa.Column(
            "suggestion_threshold_character", sa.Float(), nullable=False,
            server_default="0.7",
        ),
    )
