From 6ec09c59e388711c43d9eba787c65ff8f60b9ce1 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 29 Apr 2024 00:37:18 +0200 Subject: [PATCH] On removal of Conditions and Processes, also delete their VersionedAttributes. --- plomtask/conditions.py | 2 ++ plomtask/processes.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/plomtask/conditions.py b/plomtask/conditions.py index 3379709..45aa62b 100644 --- a/plomtask/conditions.py +++ b/plomtask/conditions.py @@ -44,6 +44,8 @@ class Condition(BaseModel[int]): table_name = f'{item}_{attr}' for _ in db_conn.row_where(table_name, 'condition', self.id_): raise HandledException('cannot remove Condition in use') + db_conn.delete_where('condition_titles', 'parent', self.id_) + db_conn.delete_where('condition_descriptions', 'parent', self.id_) super().remove(db_conn) diff --git a/plomtask/processes.py b/plomtask/processes.py index e67b134..0a9b95b 100644 --- a/plomtask/processes.py +++ b/plomtask/processes.py @@ -177,6 +177,9 @@ class Process(BaseModel[int], ConditionsRelations): db_conn.delete_where('process_disables', 'process', self.id_) for step in self.explicit_steps: step.remove(db_conn) + db_conn.delete_where('process_titles', 'parent', self.id_) + db_conn.delete_where('process_descriptions', 'parent', self.id_) + db_conn.delete_where('process_efforts', 'parent', self.id_) super().remove(db_conn) -- 2.30.2