0074_add_repo_marketplace_domain_id.py
file-level
1
files
1
commits
0
hotspots
0
🧊 dead
0
💥 blast risk
| 1 | """Add marketplace_domain_id to musehub_repos |
| 2 | |
| 3 | musehub#117 Phase 3 (DOM_12): a repo needs a real, unambiguous link to a |
| 4 | registered marketplace MusehubDomain, deliberately separate from the |
| 5 | existing domain_id column (a plain VCS-plugin category string load-bearing |
| 6 | for the profile heatmap — see musehub_profile.py's active guard against a |
| 7 | real marketplace ID leaking into it). |
| 8 | |
| 9 | Revision ID: 0074 |
| 10 | Revises: 0073 |
| 11 | """ |
| 12 | from __future__ import annotations |
| 13 | |
| 14 | from typing import Sequence, Union |
| 15 | |
| 16 | from alembic import op |
| 17 | import sqlalchemy as sa |
| 18 | |
| 19 | |
| 20 | # revision identifiers, used by Alembic. |
| 21 | revision: str = '0074' |
| 22 | down_revision: Union[str, None] = '0073' |
| 23 | branch_labels: Union[str, Sequence[str], None] = None |
| 24 | depends_on: Union[str, Sequence[str], None] = None |
| 25 | |
| 26 | |
| 27 | def upgrade() -> None: |
| 28 | op.add_column('musehub_repos', sa.Column('marketplace_domain_id', sa.String(length=128), nullable=True)) |
| 29 | op.create_index( |
| 30 | op.f('ix_musehub_repos_marketplace_domain_id'), |
| 31 | 'musehub_repos', ['marketplace_domain_id'], unique=False, |
| 32 | ) |
| 33 | |
| 34 | |
| 35 | def downgrade() -> None: |
| 36 | op.drop_index(op.f('ix_musehub_repos_marketplace_domain_id'), table_name='musehub_repos') |
| 37 | op.drop_column('musehub_repos', 'marketplace_domain_id') |