gabriel / musehub public
0030_widen_id_columns_to_128.py python
48 lines 1.2 KB
Raw
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2 feat: add repair-commit wire endpoint (API parity with repa… Opus 4.8 minor ⚠ breaking 1 day ago
1 """Widen varchar(36) ID columns to varchar(128).
2
3 Several tables were created with varchar(36) IDs sized for UUIDs. The
4 mapped-dataclass refactor moved to sha256-prefixed IDs (71 chars) so these
5 columns must be widened to varchar(128) to match the model definitions.
6
7 Affected columns:
8 musehub_background_jobs.job_id
9 musehub_domain_installs.install_id
10 musehub_issue_events.event_id
11 musehub_webhook_deliveries.delivery_id
12
13 Revision ID: 0030
14 Revises: 0029
15 """
16 from __future__ import annotations
17
18 from alembic import op
19 import sqlalchemy as sa
20
21
22 revision = "0030"
23 down_revision = "0029"
24 branch_labels = None
25 depends_on = None
26
27 _COLS: list[tuple[str, str]] = [
28 ("musehub_background_jobs", "job_id"),
29 ("musehub_domain_installs", "install_id"),
30 ("musehub_issue_events", "event_id"),
31 ("musehub_webhook_deliveries", "delivery_id"),
32 ]
33
34
35 def upgrade() -> None:
36 conn = op.get_bind()
37 for table, col in _COLS:
38 conn.execute(sa.text(
39 f"ALTER TABLE {table} ALTER COLUMN {col} TYPE varchar(128)"
40 ))
41
42
43 def downgrade() -> None:
44 conn = op.get_bind()
45 for table, col in _COLS:
46 conn.execute(sa.text(
47 f"ALTER TABLE {table} ALTER COLUMN {col} TYPE varchar(36)"
48 ))
File History 1 commit
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2 feat: add repair-commit wire endpoint (API parity with repa… Opus 4.8 minor 1 day ago