From: Christian Heller Date: Sun, 28 Apr 2024 22:37:18 +0000 (+0200) Subject: On removal of Conditions and Processes, also delete their VersionedAttributes. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%22https:/validator.w3.org/tasks?a=commitdiff_plain;h=6ec09c59e388711c43d9eba787c65ff8f60b9ce1;p=plomtask On removal of Conditions and Processes, also delete their VersionedAttributes. --- 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)