|
| 1 | +"""update_officer_term_constraint_71 |
| 2 | +
|
| 3 | +Revision ID: a5c42bcdda5c |
| 4 | +Revises: 876041e5b41c |
| 5 | +Create Date: 2025-09-28 18:03:54.856781 |
| 6 | +
|
| 7 | +""" |
| 8 | +from typing import Sequence, Union |
| 9 | + |
| 10 | +from alembic import op |
| 11 | +import sqlalchemy as sa |
| 12 | + |
| 13 | + |
| 14 | +# revision identifiers, used by Alembic. |
| 15 | +revision: str = 'a5c42bcdda5c' |
| 16 | +down_revision: Union[str, None] = '876041e5b41c' |
| 17 | +branch_labels: Union[str, Sequence[str], None] = None |
| 18 | +depends_on: Union[str, Sequence[str], None] = None |
| 19 | + |
| 20 | + |
| 21 | +def upgrade() -> None: |
| 22 | + # ### commands auto generated by Alembic - please adjust! ### |
| 23 | + op.alter_column('election', 'type', |
| 24 | + existing_type=sa.VARCHAR(length=64), |
| 25 | + type_=sa.String(length=32), |
| 26 | + nullable=False) |
| 27 | + op.create_unique_constraint(op.f('uq_officer_term_computing_id'), 'officer_term', ['computing_id', 'position', 'start_date']) |
| 28 | + # ### end Alembic commands ### |
| 29 | + |
| 30 | + |
| 31 | +def downgrade() -> None: |
| 32 | + # ### commands auto generated by Alembic - please adjust! ### |
| 33 | + op.drop_constraint(op.f('uq_officer_term_computing_id'), 'officer_term', type_='unique') |
| 34 | + op.alter_column('election', 'type', |
| 35 | + existing_type=sa.String(length=32), |
| 36 | + type_=sa.VARCHAR(length=64), |
| 37 | + nullable=True) |
| 38 | + # ### end Alembic commands ### |
0 commit comments