20260423_1600_a1b2c3d4e5f6_widen_id_columns_to_128.py
python
sha256:9590cee1e0ccd6c76528f005b95d634d80f5019f0dcb7c371e149adc31d1fb65
refactor: enforce gRPC framing on all MWP wire traffic
Sonnet 4.6
minor
⚠ breaking
153 days ago
| 1 | """widen sha256-addressed ID columns from VARCHAR(36) to VARCHAR(128) |
| 2 | |
| 3 | Revision ID: a1b2c3d4e5f6 |
| 4 | Revises: 4e68b95b48f3 |
| 5 | Create Date: 2026-04-23 16:00:00.000000+00:00 |
| 6 | |
| 7 | """ |
| 8 | from __future__ import annotations |
| 9 | |
| 10 | from typing import Sequence, Union |
| 11 | |
| 12 | import sqlalchemy as sa |
| 13 | from alembic import op |
| 14 | |
| 15 | revision: str = "a1b2c3d4e5f6" |
| 16 | down_revision: Union[str, None] = "4e68b95b48f3" |
| 17 | branch_labels: Union[str, Sequence[str], None] = None |
| 18 | depends_on: Union[str, Sequence[str], None] = None |
| 19 | |
| 20 | _COLUMNS: list[tuple[str, str]] = [ |
| 21 | ("musehub_auth_keys", "key_id"), |
| 22 | ("musehub_collaborators", "id"), |
| 23 | ("musehub_domain_installs", "user_id"), |
| 24 | ("musehub_domain_installs", "domain_id"), |
| 25 | ("musehub_forks", "fork_id"), |
| 26 | ("musehub_issue_comments", "parent_id"), |
| 27 | ("musehub_issue_labels", "label_id"), |
| 28 | ("musehub_labels", "id"), |
| 29 | ("musehub_proposal_comments", "parent_comment_id"), |
| 30 | ("musehub_proposal_labels", "label_id"), |
| 31 | ("musehub_release_assets", "asset_id"), |
| 32 | ("musehub_repos", "owner_user_id"), |
| 33 | ("musehub_webhooks", "webhook_id"), |
| 34 | ] |
| 35 | |
| 36 | |
| 37 | def upgrade() -> None: |
| 38 | for table, column in _COLUMNS: |
| 39 | op.alter_column( |
| 40 | table, column, |
| 41 | type_=sa.String(length=128), |
| 42 | existing_nullable=True, |
| 43 | ) |
| 44 | |
| 45 | |
| 46 | def downgrade() -> None: |
| 47 | for table, column in _COLUMNS: |
| 48 | op.alter_column( |
| 49 | table, column, |
| 50 | type_=sa.String(length=36), |
| 51 | existing_nullable=True, |
| 52 | ) |
File History
1 commit
sha256:9590cee1e0ccd6c76528f005b95d634d80f5019f0dcb7c371e149adc31d1fb65
refactor: enforce gRPC framing on all MWP wire traffic
Sonnet 4.6
minor
⚠
153 days ago