"""auth_token

Revision: 0201
Revision ID: d8b702a1eee2
Revises: 38e954f8faf0
Create Date: 2021-01-05 16:05:07.822359

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


# revision identifiers, used by Alembic.
revision = 'd8b702a1eee2'
down_revision = '38e954f8faf0'
branch_labels = None
depends_on = None


def upgrade():
    op.add_column('users', sa.Column('auth_token', sa.String(), nullable=True))
    op.create_index(op.f('ix_users_auth_token'), 'users', ['auth_token'], unique=True)
    op.execute("""UPDATE users SET auth_token = id""")


def downgrade():
    op.drop_column('users', 'auth_token')
