cr-connect-workflow/migrations/versions/29bad12c9945_.py

66 lines
3.3 KiB
Python

"""empty message
Revision ID: 29bad12c9945
Revises: c51ea6590f5d
Create Date: 2022-02-10 10:24:27.796228
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '29bad12c9945'
down_revision = 'c51ea6590f5d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('task_event_workflow_spec_id_fkey', 'task_event', type_='foreignkey')
op.drop_constraint('workflow_workflow_spec_id_fkey', 'workflow', type_='foreignkey')
op.drop_constraint('workflow_library_workflow_spec_id_fkey', 'workflow_library', type_='foreignkey')
op.drop_table('workflow_library')
op.drop_table('workflow_spec')
op.drop_table('workflow_spec_category')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_foreign_key('workflow_workflow_spec_id_fkey', 'workflow', 'workflow_spec', ['workflow_spec_id'], ['id'])
op.create_foreign_key('task_event_workflow_spec_id_fkey', 'task_event', 'workflow_spec', ['workflow_spec_id'], ['id'])
op.create_table('workflow_spec',
sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column('display_name', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True),
sa.Column('is_master_spec', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.Column('category_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('display_order', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('standalone', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.Column('library', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.Column('primary_file_name', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('primary_process_id', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('is_review', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['category_id'], ['workflow_spec_category.id'], name='workflow_spec_category_id_fkey'),
sa.PrimaryKeyConstraint('id', name='workflow_spec_pkey'),
postgresql_ignore_search_path=False
)
op.create_table('workflow_library',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('workflow_spec_id', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('library_spec_id', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['library_spec_id'], ['workflow_spec.id'], name='workflow_library_library_spec_id_fkey'),
sa.ForeignKeyConstraint(['workflow_spec_id'], ['workflow_spec.id'], name='workflow_library_workflow_spec_id_fkey'),
sa.PrimaryKeyConstraint('id', name='workflow_library_pkey')
)
op.create_table('workflow_spec_category',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('display_name', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('display_order', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('admin', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='workflow_spec_category_pkey')
)
# ### end Alembic commands ###