gabriel / musehub public
0030_widen_id_columns_to_128.py python
48 lines 1.2 KB
Raw
sha256:e519738f2102d625d47828a17d113283cd744577b43551013cb668fd04f1c3fe chore(mwp8/phase5): tick all RG checkboxes; close-out doc (… Sonnet 4.6 18 days 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 2 commits
sha256:e519738f2102d625d47828a17d113283cd744577b43551013cb668fd04f1c3fe chore(mwp8/phase5): tick all RG checkboxes; close-out doc (… Sonnet 4.6 18 days ago
sha256:0e5174da777684df43b2db71f282079030ef28bacffb93e19c29ee712b2a8bc4 test(mwp8/phase0): audit — repair+force-push leave stale ca… Sonnet 4.6 20 days ago