"""Add jobs table

Revision ID: 5706baf73b01
Revises: <KEY>
Create Date: 2016-09-14 15:53:50.394610

"""

# revision identifiers, used by Alembic.
revision = '5706baf73b01'
down_revision = '<KEY>'

from alembic import op
import sqlalchemy as sa
import server


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('job',
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('updated', sa.DateTime(timezone=True), nullable=True),
    sa.Column('status', sa.Enum('queued', 'running', 'finished', name='status'), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('course_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=False),
    sa.Column('description', sa.Text(), nullable=False),
    sa.Column('failed', sa.Boolean(), nullable=False),
    sa.Column('log', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['course_id'], ['course.id'], name=op.f('fk_job_course_id_course')),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_job_user_id_user')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_job'))
    )
    op.create_index(op.f('ix_job_course_id'), 'job', ['course_id'], unique=False)
    op.create_index(op.f('ix_job_user_id'), 'job', ['user_id'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_job_user_id'), table_name='job')
    op.drop_index(op.f('ix_job_course_id'), table_name='job')
    op.drop_table('job')
    ### end Alembic commands ###

"""Add jobs table

Revision ID: 5706baf73b01
Revises: <KEY>
Create Date: 2016-09-14 15:53:50.394610

"""

# revision identifiers, used by Alembic.
revision = '5706baf73b01'
down_revision = '<KEY>'

from alembic import op
import sqlalchemy as sa
import server


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('job',
    sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('updated', sa.DateTime(timezone=True), nullable=True),
    sa.Column('status', sa.Enum('queued', 'running', 'finished', name='status'), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('course_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=False),
    sa.Column('description', sa.Text(), nullable=False),
    sa.Column('failed', sa.Boolean(), nullable=False),
    sa.Column('log', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['course_id'], ['course.id'], name=op.f('fk_job_course_id_course')),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_job_user_id_user')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_job'))
    )
    op.create_index(op.f('ix_job_course_id'), 'job', ['course_id'], unique=False)
    op.create_index(op.f('ix_job_user_id'), 'job', ['user_id'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_job_user_id'), table_name='job')
    op.drop_index(op.f('ix_job_course_id'), table_name='job')
    op.drop_table('job')
    ### end Alembic commands ###

Add jobs table  Revision ID: 5706baf73b01 Revises: <KEY> Create Date: 2016-09-14 15:53:50.394610 # revision identifiers, used by Alembic. ### commands auto generated by Alembic - please adjust! ### ### end Alembic commands ### ### commands auto generated by Alembic - please adjust! ### ### end Alembic commands ###