"""empty message

Revision ID: 1ff0a334d40d
Revises: 
Create Date: 2018-02-23 23:36:11.771012

"""
from alembic import op
import sqlalchemy as sa
import app


# revision identifiers, used by Alembic.
revision = '1ff0a334d40d'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('celery_crontabs',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('minute', sa.String(length=64), nullable=True),
    sa.Column('hour', sa.String(length=64), nullable=True),
    sa.Column('day_of_week', sa.String(length=64), nullable=True),
    sa.Column('day_of_month', sa.String(length=64), nullable=True),
    sa.Column('month_of_year', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('celery_intervals',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('every', sa.Integer(), nullable=False),
    sa.Column('period', sa.String(length=24), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user_group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('schedule',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('timezone', sa.String(), nullable=True),
    sa.Column('trange', app.helpers.TIMERANGE(), nullable=True),
    sa.Column('type', sa.String(), nullable=True),
    sa.Column('user_group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_group_id'], ['user_group.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=80), nullable=False),
    sa.Column('email', sa.String(length=80), nullable=False),
    sa.Column('password', sa.String(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('first_name', sa.String(length=30), nullable=True),
    sa.Column('last_name', sa.String(length=30), nullable=True),
    sa.Column('active', sa.Boolean(), nullable=True),
    sa.Column('is_admin', sa.Boolean(), nullable=True),
    sa.Column('user_group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_group_id'], ['user_group.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('username')
    )
    op.create_table('celery_schedules',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=True),
    sa.Column('task', sa.String(length=255), nullable=True),
    sa.Column('interval_id', sa.Integer(), nullable=True),
    sa.Column('crontab_id', sa.Integer(), nullable=True),
    sa.Column('arguments', sa.String(length=255), nullable=True),
    sa.Column('keyword_arguments', sa.String(length=255), nullable=True),
    sa.Column('queue', sa.String(length=255), nullable=True),
    sa.Column('exchange', sa.String(length=255), nullable=True),
    sa.Column('routing_key', sa.String(length=255), nullable=True),
    sa.Column('expires', sa.DateTime(), nullable=True),
    sa.Column('enabled', sa.Boolean(), nullable=True),
    sa.Column('last_run_at', sa.DateTime(), nullable=True),
    sa.Column('total_run_count', sa.Integer(), nullable=True),
    sa.Column('date_changed', sa.DateTime(), nullable=True),
    sa.Column('board_schedule_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['board_schedule_id'], ['schedule.id'], ),
    sa.ForeignKeyConstraint(['crontab_id'], ['celery_crontabs.id'], ),
    sa.ForeignKeyConstraint(['interval_id'], ['celery_intervals.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('queue_board',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('schedule_id', sa.Integer(), nullable=True),
    sa.Column('max_on_deck', sa.Integer(), nullable=True),
    sa.Column('max_allowed_break', sa.Integer(), nullable=True),
    sa.Column('next_break_wait_time', sa.Integer(), nullable=True),
    sa.Column('max_duration', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['schedule_id'], ['schedule.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('queue_board')
    op.drop_table('celery_schedules')
    op.drop_table('user')
    op.drop_table('schedule')
    op.drop_table('user_group')
    op.drop_table('celery_intervals')
    op.drop_table('celery_crontabs')
    # ### end Alembic commands ###
