"""Updated PipelineCatalog keys

Revision ID: 8eaf33482c09
Revises: bb2bd0a8c95a
Create Date: 2016-08-02 15:26:21.660141

"""

# revision identifiers, used by Alembic.
revision = '8eaf33482c09'
down_revision = 'bb2bd0a8c95a'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('pipeline_catalog2',
    sa.Column('pipeline_type_id', sa.Integer(), nullable=False),
    sa.Column('current_task_type_id', sa.Integer(), nullable=False),
    sa.Column('next_task_type_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['current_task_type_id'], ['task_types.id'], ),
    sa.ForeignKeyConstraint(['next_task_type_id'], ['task_types.id'], ),
    sa.ForeignKeyConstraint(['pipeline_type_id'], ['pipeline_types.id'], ),
    sa.PrimaryKeyConstraint('pipeline_type_id', 'current_task_type_id', 'next_task_type_id')
    )
    op.drop_table('pipeline_catalog')
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('pipeline_catalog',
    sa.Column('pipeline_type_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
    sa.Column('current_task_type_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('next_task_type_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['current_task_type_id'], [u'task_types.id'], name=u'pipeline_catalog_ibfk_1'),
    sa.ForeignKeyConstraint(['next_task_type_id'], [u'task_types.id'], name=u'pipeline_catalog_ibfk_2'),
    sa.ForeignKeyConstraint(['pipeline_type_id'], [u'pipeline_types.id'], name=u'pipeline_catalog_ibfk_3'),
    sa.PrimaryKeyConstraint('pipeline_type_id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.drop_table('pipeline_catalog2')
    ### end Alembic commands ###