"""Added scheduled_task

Revision ID: 5aa5377a1b3
Revises: 14ed44ca815
Create Date: 2015-08-03 17:21:28.861220

"""

# revision identifiers, used by Alembic.
revision = '5aa5377a1b3'
down_revision = '14ed44ca815'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_account():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('scheduled_task',
    sa.Column('task_id', sa.Integer(), nullable=False),
    sa.Column('task_name', sa.String(length=64), nullable=True),
    sa.Column('customer_id', sa.Integer(), nullable=True),
    sa.Column('started', sa.DateTime(), nullable=True),
    sa.Column('next_scheduled', sa.DateTime(), nullable=True),
    sa.Column('frequency', sa.String(length=64), nullable=False),
    sa.Column('last', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['customer_id'], ['customer.customer_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('task_id')
    )
    op.create_index(op.f('ix_scheduled_task_customer_id'), 'scheduled_task', ['customer_id'], unique=False)
    op.create_index(op.f('ix_scheduled_task_last'), 'scheduled_task', ['last'], unique=False)
    op.create_index(op.f('ix_scheduled_task_next_scheduled'), 'scheduled_task', ['next_scheduled'], unique=False)
    op.create_index(op.f('ix_scheduled_task_started'), 'scheduled_task', ['started'], unique=False)
    op.create_index(op.f('ix_scheduled_task_task_name'), 'scheduled_task', ['task_name'], unique=False)
    ### end Alembic commands ###


def downgrade_account():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_scheduled_task_task_name'), table_name='scheduled_task')
    op.drop_index(op.f('ix_scheduled_task_started'), table_name='scheduled_task')
    op.drop_index(op.f('ix_scheduled_task_next_scheduled'), table_name='scheduled_task')
    op.drop_index(op.f('ix_scheduled_task_last'), table_name='scheduled_task')
    op.drop_index(op.f('ix_scheduled_task_customer_id'), table_name='scheduled_task')
    op.drop_table('scheduled_task')
    ### end Alembic commands ###


def upgrade_fitter():
    pass


def downgrade_fitter():
    pass

