# pylint: disable=invalid-name
"""adding audit math type

Revision ID: 8bc5c2037187
Revises: b5fcf654c681
Create Date: 2020-11-03 17:12:18.892422+00:00

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "8bc5c2037187"
down_revision = "9956d373c6b8"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    audit_math_type_enum = sa.dialects.postgresql.ENUM(
        "BRAVO", "MINERVA", "SUPERSIMPLE", "MACRO", name="auditmathtype"
    )
    audit_math_type_enum.create(op.get_bind())
    op.add_column(
        "election",
        sa.Column("audit_math_type", audit_math_type_enum),
    )
    op.execute(
        """
        UPDATE election
        SET audit_math_type = 'BRAVO'
        """
    )
    op.alter_column("election", "audit_math_type", nullable=False)
    # ### end Alembic commands ###


def downgrade():  # pragma: no cover
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###
