summaryrefslogtreecommitdiff
path: root/makima/src/db/repository.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/db/repository.rs')
-rw-r--r--makima/src/db/repository.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs
index 9dedc14..930a73e 100644
--- a/makima/src/db/repository.rs
+++ b/makima/src/db/repository.rs
@@ -5072,6 +5072,15 @@ pub async fn delete_directive_for_owner(
owner_id: Uuid,
id: Uuid,
) -> Result<bool, sqlx::Error> {
+ // Delete all tasks associated with this directive
+ sqlx::query(
+ r#"DELETE FROM tasks WHERE directive_id = $1 AND owner_id = $2"#,
+ )
+ .bind(id)
+ .bind(owner_id)
+ .execute(pool)
+ .await?;
+
let result = sqlx::query(
r#"DELETE FROM directives WHERE id = $1 AND owner_id = $2"#,
)