"""empty message

Revision ID: ac2c59642f3d
Revises: 3a0072e54c00
Create Date: 2022-04-11 10:11:02.164569

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ac2c59642f3d'
down_revision = '3a0072e54c00'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('user_tag', sa.String(), nullable=True))
    user_tag = sa.table('user', sa.column('user_tag'))
    userid = sa.table('user', sa.column('id'))
    op.execute(user_tag.update().values(user_tag=userid.c.id))
    op.alter_column('user', 'user_tag', nullable=False)
    op.create_unique_constraint(None, 'user', ['user_tag'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'user', type_='unique')
    op.drop_column('user', 'user_tag')
    # ### end Alembic commands ###
