"""Add manager role

Revision ID: add_manager_role
Revises: 25da158dd705
Create Date: 2024-03-20 10:00:00.000000

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import inspect


# revision identifiers, used by Alembic.
revision = 'add_manager_role'
down_revision = '25da158dd705'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    inspector = inspect(conn)
    columns = [col['name'] for col in inspector.get_columns('user')]
    
    with op.batch_alter_table('user', schema=None) as batch_op:
        if 'is_manager' not in columns:
            batch_op.add_column(sa.Column('is_manager', sa.Boolean(), nullable=True, server_default='false'))

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.drop_column('is_manager')

    # ### end Alembic commands ### 