Model changes and revision file for task_spec column to file and data_store models

This commit is contained in:
mike cullerton 2021-08-26 10:36:10 -04:00
parent ea08643bcd
commit 3d7dadc319
3 changed files with 30 additions and 1 deletions

View File

@ -11,7 +11,7 @@ class DataStoreModel(db.Model):
key = db.Column(db.String, nullable=False)
workflow_id = db.Column(db.Integer)
study_id = db.Column(db.Integer, nullable=True)
task_id = db.Column(db.String)
task_spec = db.Column(db.String)
spec_id = db.Column(db.String)
user_id = db.Column(db.String, nullable=True)
file_id = db.Column(db.Integer, db.ForeignKey('file.id'), nullable=True)

View File

@ -83,6 +83,7 @@ class FileModel(db.Model):
primary_process_id = db.Column(db.String, nullable=True) # An id in the xml of BPMN documents, for primary BPMN.
workflow_spec_id = db.Column(db.String, db.ForeignKey('workflow_spec.id'), nullable=True)
workflow_id = db.Column(db.Integer, db.ForeignKey('workflow.id'), nullable=True)
task_spec = db.Column(db.String, nullable=True)
irb_doc_code = db.Column(db.String, nullable=True) # Code reference to the irb_documents.xlsx reference file.
# A request was made to delete the file, but we can't because there are
# active approvals or running workflows that depend on it. So we archive

View File

@ -0,0 +1,28 @@
"""Delete file stuff - add task_spec to file and data_store
Revision ID: 981156283cb9
Revises: 3d9ae7cfc231
Create Date: 2021-08-26 09:51:58.422819
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '981156283cb9'
down_revision = '3d9ae7cfc231'
branch_labels = None
depends_on = None
def upgrade():
op.add_column('data_store', sa.Column('task_spec', sa.String(), nullable=True))
op.drop_column('data_store', 'task_id')
op.add_column('file', sa.Column('task_spec', sa.String(), nullable=True))
def downgrade():
op.drop_column('file', 'task_spec')
op.add_column('data_store', sa.Column('task_id', sa.VARCHAR(), autoincrement=False, nullable=True))
op.drop_column('data_store', 'task_spec')