cr-connect-workflow/migrations/versions/f9c4e92a8afe_.py

84 lines
3.4 KiB
Python
Raw Normal View History

"""empty message
2020-02-04 19:26:53 +00:00
Revision ID: f9c4e92a8afe
Revises:
2020-02-04 19:26:53 +00:00
Create Date: 2020-02-04 12:49:57.265041
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
2020-02-04 19:26:53 +00:00
revision = 'f9c4e92a8afe'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('study',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(), nullable=True),
sa.Column('last_updated', sa.DateTime(timezone=True), nullable=True),
2019-12-18 19:16:26 +00:00
sa.Column('protocol_builder_status', sa.Enum('out_of_date', 'in_process', 'complete', 'updating', name='protocolbuilderstatus'), nullable=True),
sa.Column('primary_investigator_id', sa.String(), nullable=True),
sa.Column('sponsor', sa.String(), nullable=True),
sa.Column('ind_number', sa.String(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
2019-12-18 19:16:26 +00:00
op.create_table('workflow_spec',
sa.Column('id', sa.String(), nullable=False),
sa.Column('name', sa.String(), nullable=True),
2019-12-18 19:16:26 +00:00
sa.Column('display_name', sa.String(), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('primary_process_id', sa.String(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('workflow',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('bpmn_workflow_json', sa.JSON(), nullable=True),
2019-12-18 19:16:26 +00:00
sa.Column('status', sa.Enum('new', 'user_input_required', 'waiting', 'complete', name='workflowstatus'), nullable=True),
sa.Column('study_id', sa.Integer(), nullable=True),
sa.Column('workflow_spec_id', sa.String(), nullable=True),
2019-12-18 19:16:26 +00:00
sa.ForeignKeyConstraint(['study_id'], ['study.id'], ),
sa.ForeignKeyConstraint(['workflow_spec_id'], ['workflow_spec.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('file',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=True),
sa.Column('version', sa.Integer(), nullable=True),
sa.Column('last_updated', sa.DateTime(timezone=True), nullable=True),
2020-02-04 19:26:53 +00:00
sa.Column('type', sa.Enum('bpmn', 'dmn', 'docx', 'gif', 'jpg', 'pdf', 'png', 'svg', 'xlsx', 'zip', 'image', name='filetype'), nullable=True),
sa.Column('primary', sa.Boolean(), nullable=True),
sa.Column('content_type', sa.String(), nullable=True),
sa.Column('workflow_spec_id', sa.String(), nullable=True),
sa.Column('workflow_id', sa.Integer(), nullable=True),
sa.Column('study_id', sa.Integer(), nullable=True),
sa.Column('task_id', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['study_id'], ['study.id'], ),
sa.ForeignKeyConstraint(['workflow_id'], ['workflow.id'], ),
sa.ForeignKeyConstraint(['workflow_spec_id'], ['workflow_spec.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('file_data',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('data', sa.LargeBinary(), nullable=True),
sa.Column('file_model_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['file_model_id'], ['file.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('file_data')
op.drop_table('file')
op.drop_table('workflow')
2019-12-18 19:16:26 +00:00
op.drop_table('workflow_spec')
op.drop_table('study')
# ### end Alembic commands ###