"""add token

Revision ID: 1611c034f927
Revises: 7c2ea146ad7a
Create Date: 2019-01-01 18:31:36.336951

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1611c034f927'
down_revision = '7c2ea146ad7a'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('token',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('userid', sa.Integer(), nullable=True),
    sa.Column('token', sa.String(length=32), nullable=True),
    sa.Column('token_expiration', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['userid'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_token_token'), 'token', ['token'], unique=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_token_token'), table_name='token')
    op.drop_table('token')
    # ### end Alembic commands ###
