"""empty message

Revision ID: 51defad68f16
Revises: 
Create Date: 2020-02-03 21:39:30.420553

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '51defad68f16'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_group_name'), 'group', ['name'], unique=True)
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.Column('rank', sa.String(length=10), nullable=True),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('account_type', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['group.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_account_type'), 'user', ['account_type'], unique=False)
    op.create_index(op.f('ix_user_name'), 'user', ['name'], unique=True)
    op.create_index(op.f('ix_user_rank'), 'user', ['rank'], unique=False)
    op.create_table('p_state',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('date', sa.Date(), nullable=True),
    sa.Column('end_date', sa.Date(), nullable=True),
    sa.Column('state_am', sa.String(length=32), nullable=True),
    sa.Column('state_am_reason', sa.String(length=32), nullable=True),
    sa.Column('state_am_location', sa.String(length=32), nullable=True),
    sa.Column('full_day', sa.Boolean(), nullable=True),
    sa.Column('state_pm', sa.String(length=32), nullable=True),
    sa.Column('state_pm_reason', sa.String(length=32), nullable=True),
    sa.Column('state_pm_location', sa.String(length=32), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_p_state_date'), 'p_state', ['date'], unique=False)
    op.create_index(op.f('ix_p_state_end_date'), 'p_state', ['end_date'], unique=False)
    op.create_index(op.f('ix_p_state_full_day'), 'p_state', ['full_day'], unique=False)
    op.create_index(op.f('ix_p_state_state_am'), 'p_state', ['state_am'], unique=False)
    op.create_index(op.f('ix_p_state_state_am_location'), 'p_state', ['state_am_location'], unique=False)
    op.create_index(op.f('ix_p_state_state_am_reason'), 'p_state', ['state_am_reason'], unique=False)
    op.create_index(op.f('ix_p_state_state_pm'), 'p_state', ['state_pm'], unique=False)
    op.create_index(op.f('ix_p_state_state_pm_location'), 'p_state', ['state_pm_location'], unique=False)
    op.create_index(op.f('ix_p_state_state_pm_reason'), 'p_state', ['state_pm_reason'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_p_state_state_pm_reason'), table_name='p_state')
    op.drop_index(op.f('ix_p_state_state_pm_location'), table_name='p_state')
    op.drop_index(op.f('ix_p_state_state_pm'), table_name='p_state')
    op.drop_index(op.f('ix_p_state_state_am_reason'), table_name='p_state')
    op.drop_index(op.f('ix_p_state_state_am_location'), table_name='p_state')
    op.drop_index(op.f('ix_p_state_state_am'), table_name='p_state')
    op.drop_index(op.f('ix_p_state_full_day'), table_name='p_state')
    op.drop_index(op.f('ix_p_state_end_date'), table_name='p_state')
    op.drop_index(op.f('ix_p_state_date'), table_name='p_state')
    op.drop_table('p_state')
    op.drop_index(op.f('ix_user_rank'), table_name='user')
    op.drop_index(op.f('ix_user_name'), table_name='user')
    op.drop_index(op.f('ix_user_account_type'), table_name='user')
    op.drop_table('user')
    op.drop_index(op.f('ix_group_name'), table_name='group')
    op.drop_table('group')
    # ### end Alembic commands ###
