"""Retire the 'archived' Record status.

'archived' was added by migration 0081 as a nominal sideways-only
destination once a record reached 'interred', but no feature ever grew
around it: no dedicated UI action, no automation ever wrote it, and no
tests exercised it beyond the transition-allowed check itself. It also
never gated public visibility or the plan record-limit count, so it
carried none of the semantics its name implied. Removed at product
decision rather than left as unused scaffolding (see RecordStatus in
src/core/constants.py).

Any existing 'archived' rows are backfilled to 'interred' — 'archived' was
only ever reachable from 'interred' (see validate_record_status_transition
pre-0082), so 'interred' is the accurate prior state.

Revision ID: 0082
Revises: 0081
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

revision: str = "0082"
down_revision: Union[str, None] = "0081"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.execute(sa.text("UPDATE records SET status = 'interred' WHERE status = 'archived'"))


def downgrade() -> None:
    """No-op: which 'interred' rows were originally 'archived' is not
    recoverable (matches this codebase's existing convention for one-way-safe
    data migrations, e.g. 0080/0081)."""
    pass
