Dan Funk d85ca1ce51 Whenever a workflow is loaded or updated, add events to the TaskEvent table with assignments for the next set of ready tasks, along with who should complete those tasks.
Add the lane information to the Task model.
Drop the foreign key constraint on the user_uid in the task log, as we might create tasks for users before they ever log into the system.
Add a new endpoint to the API called task events.  It should be possible to query this and get a list of all tasks that need a users attention.
The task events returned include detailed information about the workflow and study as sub-models
Rename all the actions in event log to things that are easier to pass over the api as arguments, make this backwards compatible, updating existing names in the database via the migration.
Throughly test the navigation and task details as control of the workflow is passed between two lanes.
2020-07-14 22:16:44 -04:00

39 lines
1.5 KiB
Python

"""empty message
Revision ID: ffef4661a37d
Revises: 5acd138e969c
Create Date: 2020-07-14 19:52:05.270939
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ffef4661a37d'
down_revision = '5acd138e969c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('task_event', sa.Column('task_lane', sa.String(), nullable=True))
op.drop_constraint('task_event_user_uid_fkey', 'task_event', type_='foreignkey')
op.execute("update task_event set action = 'COMPLETE' where action='Complete'")
op.execute("update task_event set action = 'TOKEN_RESET' where action='Backwards Move'")
op.execute("update task_event set action = 'HARD_RESET' where action='Restart (Hard)'")
op.execute("update task_event set action = 'SOFT_RESET' where action='Restart (Soft)'")
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_foreign_key('task_event_user_uid_fkey', 'task_event', 'user', ['user_uid'], ['uid'])
op.drop_column('task_event', 'task_lane')
op.execute("update task_event set action = 'Complete' where action='COMPLETE'")
op.execute("update task_event set action = 'Backwards Move' where action='TOKEN_RESET'")
op.execute("update task_event set action = 'Restart (Hard)' where action='HARD_RESET'")
op.execute("update task_event set action = 'Restart (Soft)' where action='SOFT_RESET'")
# ### end Alembic commands ###