"""Fix ORM↔migration drift: unique constraint, drop unused index, fix merge_strategy default Migration 0071 created ix_fetch_mpack_cache_repo_tip as a unique index but the ORM model uses UniqueConstraint. Also drops the unused ix_proposal_comments_author_user_id index and updates the merge_strategy server default from state_overlay to overlay (matching migration 0070's data rename). Revision ID: 0072 Revises: 0071 """ from __future__ import annotations from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = '0072' down_revision: Union[str, None] = '0071' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_fetch_mpack_cache_repo_tip'), table_name='musehub_fetch_mpack_cache') op.create_unique_constraint('uq_fetch_mpack_cache_repo_tip', 'musehub_fetch_mpack_cache', ['repo_id', 'tip_commit_id']) op.drop_index(op.f('ix_proposal_comments_author_user_id'), table_name='musehub_proposal_comments') op.alter_column('musehub_proposals', 'merge_strategy', existing_type=sa.VARCHAR(length=50), server_default='overlay', existing_nullable=False) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.alter_column('musehub_proposals', 'merge_strategy', existing_type=sa.VARCHAR(length=50), server_default=sa.text("'state_overlay'::character varying"), existing_nullable=False) op.create_index(op.f('ix_proposal_comments_author_user_id'), 'musehub_proposal_comments', ['author_user_id'], unique=False) op.drop_constraint('uq_fetch_mpack_cache_repo_tip', 'musehub_fetch_mpack_cache', type_='unique') op.create_index(op.f('ix_fetch_mpack_cache_repo_tip'), 'musehub_fetch_mpack_cache', ['repo_id', 'tip_commit_id'], unique=True) # ### end Alembic commands ###