# pylint: disable=invalid-name
"""CvrBallot unique constraint

Revision ID: b91b345bf0a9
Revises: f44bbbb8b076
Create Date: 2021-04-06 21:39:10.364600+00:00

"""
from alembic import op


# revision identifiers, used by Alembic.
revision = "b91b345bf0a9"
down_revision = "f44bbbb8b076"
branch_labels = None
depends_on = None


def upgrade():
    op.drop_constraint("cvr_ballot_pkey", "cvr_ballot")
    op.create_primary_key(
        op.f("cvr_ballot_pkey"), "cvr_ballot", ["batch_id", "record_id"]
    )
    op.alter_column("cvr_ballot", "ballot_position", nullable=True)
    op.create_unique_constraint(
        op.f("cvr_ballot_batch_id_ballot_position_key"),
        "cvr_ballot",
        ["batch_id", "ballot_position"],
    )


def downgrade():  # pragma: no cover
    pass
    # ### commands auto generated by Alembic - please adjust! ###
    # op.drop_constraint(
    #     op.f("cvr_ballot_batch_id_ballot_position_key"), "cvr_ballot", type_="unique"
    # )
    # op.alter_column(
    #     "cvr_ballot", "ballot_position", existing_type=sa.INTEGER(), nullable=False
    # )
    # ### end Alembic commands ###
