"""rt_member: replace name with localuser

Revision ID: 20c21e6832e2
Revises: 300805031b51
Create Date: 2022-02-01 15:18:12.830422

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '20c21e6832e2'
down_revision = '300805031b51'
branch_labels = None
depends_on = None


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('rt_member', sa.Column('localuser_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'rt_member', 'localuser', ['localuser_id'], ['id'])
    op.drop_column('rt_member', 'email')
    op.drop_column('rt_member', 'active')
    op.drop_column('rt_member', 'name')
    # ### end Alembic commands ###


def downgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('rt_member', sa.Column('name', mysql.TEXT(), nullable=True))
    op.add_column('rt_member', sa.Column('active', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.add_column('rt_member', sa.Column('email', mysql.TEXT(), nullable=True))
    op.drop_constraint(None, 'rt_member', type_='foreignkey')
    op.drop_column('rt_member', 'localuser_id')
    # ### end Alembic commands ###


def upgrade_users():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def downgrade_users():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###

