"""Widen varchar(36) ID columns to varchar(128). Several tables were created with varchar(36) IDs sized for UUIDs. The mapped-dataclass refactor moved to sha256-prefixed IDs (71 chars) so these columns must be widened to varchar(128) to match the model definitions. Affected columns: musehub_background_jobs.job_id musehub_domain_installs.install_id musehub_issue_events.event_id musehub_webhook_deliveries.delivery_id Revision ID: 0030 Revises: 0029 """ from __future__ import annotations from alembic import op import sqlalchemy as sa revision = "0030" down_revision = "0029" branch_labels = None depends_on = None _COLS: list[tuple[str, str]] = [ ("musehub_background_jobs", "job_id"), ("musehub_domain_installs", "install_id"), ("musehub_issue_events", "event_id"), ("musehub_webhook_deliveries", "delivery_id"), ] def upgrade() -> None: conn = op.get_bind() for table, col in _COLS: conn.execute(sa.text( f"ALTER TABLE {table} ALTER COLUMN {col} TYPE varchar(128)" )) def downgrade() -> None: conn = op.get_bind() for table, col in _COLS: conn.execute(sa.text( f"ALTER TABLE {table} ALTER COLUMN {col} TYPE varchar(36)" ))