"""drop migration_run — one-and-done GS/IR migration tooling removed Revision ID: 0027 Revises: 0026 Create Date: 2026-05-29 The GS/IR migration tooling (services/migrators, /api/migrate, the run_migration task, LegacyMigrationCard, and the MigrationRun model) was removed after the migration cutover completed. This drops its now-orphaned run-log table. Downgrade recreates the table (mirrors the old model) so the migration is reversible. """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op from sqlalchemy.dialects.postgresql import JSONB revision: str = "0027" down_revision: Union[str, None] = "0026" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.drop_table("migration_run") def downgrade() -> None: op.create_table( "migration_run", sa.Column("id", sa.Integer(), primary_key=True), sa.Column("kind", sa.String(length=32), nullable=False), sa.Column("status", sa.String(length=32), nullable=False), sa.Column("dry_run", sa.Boolean(), nullable=False, server_default=sa.false()), sa.Column( "started_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now(), ), sa.Column("finished_at", sa.DateTime(timezone=True), nullable=True), sa.Column( "counts", JSONB(), nullable=False, server_default=sa.text("'{}'::jsonb"), ), sa.Column("error", sa.Text(), nullable=True), sa.Column( "metadata", JSONB(), nullable=False, server_default=sa.text("'{}'::jsonb"), ), ) op.create_index("ix_migration_run_kind", "migration_run", ["kind"]) op.create_index("ix_migration_run_status", "migration_run", ["status"])