"""ADD questions_assigned to assignment

Revision ID: 22b0d9fdb52f
Revises: c8cb0e5a0950
Create Date: 2021-10-23 17:56:33.803919

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "22b0d9fdb52f"
down_revision = "c8cb0e5a0950"
branch_labels = None
depends_on = None


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


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