diff --git a/src/sql.rs b/src/sql.rs index f85213851..b6a42f767 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -762,8 +762,9 @@ pub async fn housekeeping(context: &Context) -> Result<()> { context .sql .execute( - "DELETE FROM msgs_mdns WHERE msg_id NOT IN (SELECT id FROM msgs)", - (), + "DELETE FROM msgs_mdns WHERE msg_id NOT IN \ + (SELECT id FROM msgs WHERE chat_id!=?)", + (DC_CHAT_ID_TRASH,), ) .await .context("failed to remove old MDNs") @@ -773,8 +774,9 @@ pub async fn housekeeping(context: &Context) -> Result<()> { context .sql .execute( - "DELETE FROM msgs_status_updates WHERE msg_id NOT IN (SELECT id FROM msgs)", - (), + "DELETE FROM msgs_status_updates WHERE msg_id NOT IN \ + (SELECT id FROM msgs WHERE chat_id!=?)", + (DC_CHAT_ID_TRASH,), ) .await .context("failed to remove old webxdc status updates")