gabriel / musehub public

0041_widen_symbol_intel_op_column.py file-level

at sha256:3 · View file ↗ · Intel ↗

History
1 files
1 commits
0 hotspots
0 🧊 dead
0 💥 blast risk
sha256:0 fix: fall back to any indexed mpack in read_object_bytes when push mpac… · gabriel · Jun 17, 2026
1 """Widen musehub_symbol_intel.op from VARCHAR(16) to VARCHAR(32).
2
3 Revision ID: 0041
4 Revises: 0040
5 Create Date: 2026-05-07
6
7 Staging had VARCHAR(16) on this column; ORM model defines String(32).
8 Uses IF column length check so migration is safe to run on DBs where the
9 column is already the correct size.
10 """
11 from __future__ import annotations
12
13 from alembic import op
14 import sqlalchemy as sa
15
16
17 revision: str = "0041"
18 down_revision: str | None = "0040"
19 branch_labels = None
20 depends_on = None
21
22
23 def upgrade() -> None:
24 bind = op.get_bind()
25 cols = {c["name"]: c for c in sa.inspect(bind).get_columns("musehub_symbol_intel")}
26 op_col = cols.get("op")
27 if op_col and isinstance(op_col["type"], sa.VARCHAR) and op_col["type"].length == 16:
28 op.alter_column(
29 "musehub_symbol_intel", "op",
30 existing_type=sa.VARCHAR(length=16),
31 type_=sa.String(length=32),
32 existing_nullable=True,
33 )
34
35
36 def downgrade() -> None:
37 bind = op.get_bind()
38 cols = {c["name"]: c for c in sa.inspect(bind).get_columns("musehub_symbol_intel")}
39 op_col = cols.get("op")
40 if op_col and isinstance(op_col["type"], sa.VARCHAR) and op_col["type"].length == 32:
41 op.alter_column(
42 "musehub_symbol_intel", "op",
43 existing_type=sa.String(length=32),
44 type_=sa.VARCHAR(length=16),
45 existing_nullable=True,
46 )