0021_structured_delta_column.py
python
sha256:009b5a222314f47640a58d75ce5a1f428f1624cf0b51384dfcdfbdfab3cc42a4
feat: migration idempotency, file attribution DAG walk, mpa…
Sonnet 4.6
minor
⚠ breaking
9 days ago
| 1 | """Add structured_delta column to musehub_commits. |
| 2 | |
| 3 | structured_delta was stored in the dropped commit_meta JSON blob. This migration |
| 4 | adds it as a dedicated nullable JSONB column so the symbol indexer can read it |
| 5 | back without losing fidelity on historical commits. New pushes write it directly; |
| 6 | historical rows remain NULL and fall back to snapshot diffing. |
| 7 | |
| 8 | Revision ID: 0021 |
| 9 | Revises: 0020 |
| 10 | """ |
| 11 | from __future__ import annotations |
| 12 | |
| 13 | from alembic import op |
| 14 | import sqlalchemy as sa |
| 15 | from sqlalchemy.dialects.postgresql import JSONB |
| 16 | |
| 17 | revision = "0021" |
| 18 | down_revision = "0020" |
| 19 | branch_labels = None |
| 20 | depends_on = None |
| 21 | |
| 22 | |
| 23 | def upgrade() -> None: |
| 24 | op.add_column( |
| 25 | "musehub_commits", |
| 26 | sa.Column("structured_delta", JSONB(), nullable=True), |
| 27 | ) |
| 28 | |
| 29 | |
| 30 | def downgrade() -> None: |
| 31 | from sqlalchemy import text |
| 32 | op.execute(text("ALTER TABLE musehub_commits DROP COLUMN IF EXISTS structured_delta")) |
File History
1 commit
sha256:009b5a222314f47640a58d75ce5a1f428f1624cf0b51384dfcdfbdfab3cc42a4
feat: migration idempotency, file attribution DAG walk, mpa…
Sonnet 4.6
minor
⚠
9 days ago