"""add_job_to_gen_task

Revision ID: 9aa153cb12a4
Revises: 1e0b1d3e3cca
Create Date: 2016-09-08 09:59:15.023182

"""

# revision identifiers, used by Alembic.
revision = '9aa153cb12a4'
down_revision = '1e0b1d3e3cca'
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_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('file_generation_task', sa.Column('job_id', sa.Integer(), nullable=True))
    op.create_foreign_key('fk_generation_job', 'file_generation_task', 'job', ['job_id'], ['job_id'])
    op.drop_constraint('fk_publish_status_id', 'submission', type_='foreignkey')
    op.create_foreign_key('fk_publish_status_id', 'submission', 'publish_status', ['publish_status_id'], ['publish_status_id'], ondelete='SET NULL')
    ### end Alembic commands ###


def downgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('fk_publish_status_id', 'submission', type_='foreignkey')
    op.create_foreign_key('fk_publish_status_id', 'submission', 'publish_status', ['publish_status_id'], ['publish_status_id'], ondelete='CASCADE')
    op.drop_constraint('fk_generation_job', 'file_generation_task', type_='foreignkey')
    op.drop_column('file_generation_task', 'job_id')
    ### end Alembic commands ###

