"""ADD autograde_enabled to assignment

Revision ID: 452a7485f568
Revises: 3d972cfa5be9
Create Date: 2021-04-27 20:45:32.938022

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "452a7485f568"
down_revision = "3d972cfa5be9"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "assignment",
        sa.Column("autograde_enabled", sa.Boolean(), nullable=True, default=True),
    )
    conn = op.get_bind()
    with conn.begin():
        conn.execute("update assignment set autograde_enabled = 1;")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("assignment", "autograde_enabled")
    # ### end Alembic commands ###
