gabriel / musehub public
0041_widen_symbol_intel_op_column.py python
46 lines 1.4 KB
Raw
sha256:c73281cffffbc70487969720af074e54b34326d59ec6aff0827fa16512a4e512 docs(mwp-2): mark all acceptance criteria met; add closing … Sonnet 4.6 81 days ago
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 )
File History 2 commits
sha256:c73281cffffbc70487969720af074e54b34326d59ec6aff0827fa16512a4e512 docs(mwp-2): mark all acceptance criteria met; add closing … Sonnet 4.6 81 days ago
sha256:4dd2a937f66f8e36d9aa59bd1bf3cb880ca1d503fef67300a0cba3b482784081 test(mwp2): Phase 0 RED — reproduction tests for _walk_comm… Sonnet 4.6 81 days ago