From d688e2414db5c6079422655df8a132d2fd2d295d Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 19 Dec 2023 15:28:02 -0500 Subject: [PATCH] make it so we can delete TaskInstructionsForEndUserModel on instance delete --- .../src/spiffworkflow_backend/models/process_instance.py | 1 + .../unit/test_process_instance_processor.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py index ef0b4c0a..43c2ee15 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py @@ -73,6 +73,7 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel): overlaps="active_human_tasks", ) # type: ignore message_instances = relationship("MessageInstanceModel", cascade="delete") # type: ignore + task_instructions_for_end_user = relationship("TaskInstructionsForEndUserModel", cascade="delete") # type: ignore process_metadata = relationship( "ProcessInstanceMetadataModel", cascade="delete", diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py index e974627c..8bdca1e4 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py @@ -902,3 +902,6 @@ class TestProcessInstanceProcessor(BaseTest): assert len(remaining_entries) == 2 for entry in remaining_entries: assert entry.has_been_retrieved is True + + db.session.delete(process_instance) + db.session.commit()