"""ADD admin to theia_session

Revision ID: 2e9cae7411e6
Revises: 08c5273b4713
Create Date: 2021-11-27 13:09:43.138573

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "2e9cae7411e6"
down_revision = "08c5273b4713"
branch_labels = None
depends_on = None


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


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