"""table

Revision ID: 92e4ac81bbf9
Revises: 
Create Date: 2018-04-24 09:43:35.276843

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '92e4ac81bbf9'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('userval',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('d1', sa.Integer(), nullable=True),
    sa.Column('d2', sa.Integer(), nullable=True),
    sa.Column('d3', sa.Integer(), nullable=True),
    sa.Column('d4', sa.Integer(), nullable=True),
    sa.Column('d5', sa.Integer(), nullable=True),
    sa.Column('d6', sa.Integer(), nullable=True),
    sa.Column('on_off', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_userval_d1'), 'userval', ['d1'], unique=True)
    op.create_index(op.f('ix_userval_d2'), 'userval', ['d2'], unique=True)
    op.create_index(op.f('ix_userval_d3'), 'userval', ['d3'], unique=True)
    op.create_index(op.f('ix_userval_d4'), 'userval', ['d4'], unique=True)
    op.create_index(op.f('ix_userval_d5'), 'userval', ['d5'], unique=True)
    op.create_index(op.f('ix_userval_d6'), 'userval', ['d6'], unique=True)
    op.create_index(op.f('ix_userval_on_off'), 'userval', ['on_off'], unique=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_userval_on_off'), table_name='userval')
    op.drop_index(op.f('ix_userval_d6'), table_name='userval')
    op.drop_index(op.f('ix_userval_d5'), table_name='userval')
    op.drop_index(op.f('ix_userval_d4'), table_name='userval')
    op.drop_index(op.f('ix_userval_d3'), table_name='userval')
    op.drop_index(op.f('ix_userval_d2'), table_name='userval')
    op.drop_index(op.f('ix_userval_d1'), table_name='userval')
    op.drop_table('userval')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_table('user')
    # ### end Alembic commands ###
