"""empty message

Revision ID: 8c8e895a3986
Revises: 
Create Date: 2020-11-19 21:31:15.839514

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '8c8e895a3986'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('deviceTable',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('userTable',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_userTable_email'), 'userTable', ['email'], unique=True)
    op.create_index(op.f('ix_userTable_username'), 'userTable', ['username'], unique=True)
    op.create_table('UserDevices',
    sa.Column('userID', sa.Integer(), nullable=True),
    sa.Column('deviceID', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['deviceID'], ['deviceTable.id'], ),
    sa.ForeignKeyConstraint(['userID'], ['userTable.id'], )
    )
    op.create_table('unlockTable',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('dID', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['dID'], ['deviceTable.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_unlockTable_timestamp'), 'unlockTable', ['timestamp'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_unlockTable_timestamp'), table_name='unlockTable')
    op.drop_table('unlockTable')
    op.drop_table('UserDevices')
    op.drop_index(op.f('ix_userTable_username'), table_name='userTable')
    op.drop_index(op.f('ix_userTable_email'), table_name='userTable')
    op.drop_table('userTable')
    op.drop_table('deviceTable')
    # ### end Alembic commands ###
