"""ADD autograde to theia session

Revision ID: 8834f834adac
Revises: 47ffcba2ffc1
Create Date: 2022-10-16 19:04:15.745743

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "8834f834adac"
down_revision = "47ffcba2ffc1"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "theia_session", sa.Column("autograde", sa.Boolean(), nullable=True)
    )
    conn = op.get_bind()
    with conn.begin():
        conn.execute('UPDATE `theia_session` SET `autograde` = 0;')
    # ### end Alembic commands ###


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