2019-12-18 19:02:17 +00:00
|
|
|
"""empty message
|
|
|
|
|
2020-03-06 14:50:32 +00:00
|
|
|
Revision ID: 8856126b6658
|
2020-02-28 16:14:30 +00:00
|
|
|
Revises:
|
2020-03-06 14:50:32 +00:00
|
|
|
Create Date: 2020-03-06 09:49:37.872516
|
2019-12-18 19:02:17 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
2020-03-06 14:50:32 +00:00
|
|
|
from sqlalchemy.dialects import postgresql
|
2019-12-18 19:02:17 +00:00
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
2020-03-06 14:50:32 +00:00
|
|
|
revision = '8856126b6658'
|
2019-12-18 19:02:17 +00:00
|
|
|
down_revision = None
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2020-02-28 16:14:30 +00:00
|
|
|
op.create_table('user',
|
2019-12-18 19:02:17 +00:00
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
2020-02-28 16:14:30 +00:00
|
|
|
sa.Column('uid', sa.String(), nullable=True),
|
|
|
|
sa.Column('email_address', sa.String(), nullable=True),
|
|
|
|
sa.Column('display_name', sa.String(), nullable=True),
|
|
|
|
sa.Column('affiliation', sa.String(), nullable=True),
|
|
|
|
sa.Column('eppn', sa.String(), nullable=True),
|
|
|
|
sa.Column('first_name', sa.String(), nullable=True),
|
|
|
|
sa.Column('last_name', sa.String(), nullable=True),
|
2019-12-18 19:02:17 +00:00
|
|
|
sa.Column('title', sa.String(), nullable=True),
|
2020-02-28 16:14:30 +00:00
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('uid')
|
2019-12-18 19:02:17 +00:00
|
|
|
)
|
2019-12-18 19:16:26 +00:00
|
|
|
op.create_table('workflow_spec',
|
2019-12-18 19:02:17 +00:00
|
|
|
sa.Column('id', sa.String(), nullable=False),
|
2020-02-04 14:57:02 +00:00
|
|
|
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),
|
2020-02-04 14:57:02 +00:00
|
|
|
sa.Column('primary_process_id', sa.String(), nullable=True),
|
2019-12-18 19:02:17 +00:00
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2020-02-28 16:14:30 +00:00
|
|
|
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),
|
2020-03-03 21:01:36 +00:00
|
|
|
sa.Column('protocol_builder_status', sa.Enum('DRAFT', 'IN_PROCESS', 'IN_REVIEW', 'REVIEW_COMPLETE', 'INACTIVE', name='protocolbuilderstatus'), nullable=True),
|
2020-02-28 16:14:30 +00:00
|
|
|
sa.Column('primary_investigator_id', sa.String(), nullable=True),
|
|
|
|
sa.Column('sponsor', sa.String(), nullable=True),
|
|
|
|
sa.Column('hsr_number', sa.String(), nullable=True),
|
|
|
|
sa.Column('ind_number', sa.String(), nullable=True),
|
|
|
|
sa.Column('user_uid', sa.String(), nullable=False),
|
|
|
|
sa.Column('investigator_uids', sa.ARRAY(sa.String()), nullable=True),
|
|
|
|
sa.Column('inactive', sa.Boolean(), nullable=True),
|
|
|
|
sa.Column('requirements', sa.ARRAY(sa.Integer()), nullable=True),
|
|
|
|
sa.ForeignKeyConstraint(['user_uid'], ['user.uid'], ),
|
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2019-12-18 19:02:17 +00:00
|
|
|
op.create_table('workflow',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
2020-02-04 14:57:02 +00:00
|
|
|
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),
|
2020-02-04 14:57:02 +00:00
|
|
|
sa.Column('workflow_spec_id', sa.String(), nullable=True),
|
2020-03-06 14:50:32 +00:00
|
|
|
sa.Column('spec_version', 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'], ),
|
2019-12-18 19:02:17 +00:00
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2020-02-04 14:57:02 +00:00
|
|
|
op.create_table('file',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('name', sa.String(), nullable=True),
|
2020-02-05 22:23:37 +00:00
|
|
|
sa.Column('type', sa.Enum('bpmn', 'csv', 'dmn', 'doc', 'docx', 'gif', 'jpg', 'md', 'pdf', 'png', 'ppt', 'pptx', 'rtf', 'svg', 'svg_xml', 'txt', 'xls', 'xlsx', 'xml', 'zip', name='filetype'), nullable=True),
|
2020-02-04 14:57:02 +00:00
|
|
|
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),
|
2020-02-05 22:23:37 +00:00
|
|
|
sa.Column('form_field_key', sa.String(), nullable=True),
|
2020-03-06 14:50:32 +00:00
|
|
|
sa.Column('latest_version', sa.Integer(), nullable=True),
|
2020-02-04 14:57:02 +00:00
|
|
|
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),
|
2020-03-06 14:50:32 +00:00
|
|
|
sa.Column('md5_hash', postgresql.UUID(as_uuid=True), nullable=False),
|
2020-02-04 14:57:02 +00:00
|
|
|
sa.Column('data', sa.LargeBinary(), nullable=True),
|
2020-03-06 14:50:32 +00:00
|
|
|
sa.Column('version', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('last_updated', sa.DateTime(timezone=True), nullable=True),
|
2020-02-04 14:57:02 +00:00
|
|
|
sa.Column('file_model_id', sa.Integer(), nullable=True),
|
|
|
|
sa.ForeignKeyConstraint(['file_model_id'], ['file.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2019-12-18 19:02:17 +00:00
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2020-02-04 14:57:02 +00:00
|
|
|
op.drop_table('file_data')
|
|
|
|
op.drop_table('file')
|
2019-12-18 19:02:17 +00:00
|
|
|
op.drop_table('workflow')
|
|
|
|
op.drop_table('study')
|
2020-02-28 16:14:30 +00:00
|
|
|
op.drop_table('workflow_spec')
|
|
|
|
op.drop_table('user')
|
2019-12-18 19:02:17 +00:00
|
|
|
# ### end Alembic commands ###
|