mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-06 16:53:38 +02:00
Add some tests around cascade deletion behaving now that we have FK pragma turned on
This commit is contained in:
@@ -395,11 +395,11 @@ class ContactRepository:
|
||||
@staticmethod
|
||||
async def delete(public_key: str) -> None:
|
||||
normalized = public_key.lower()
|
||||
# contact_name_history and contact_advert_paths cascade via FK, but
|
||||
# messages has no FK to contacts — clean up DMs explicitly.
|
||||
await db.conn.execute(
|
||||
"DELETE FROM contact_name_history WHERE public_key = ?", (normalized,)
|
||||
)
|
||||
await db.conn.execute(
|
||||
"DELETE FROM contact_advert_paths WHERE public_key = ?", (normalized,)
|
||||
"DELETE FROM messages WHERE type = 'PRIV' AND conversation_key = ?",
|
||||
(normalized,),
|
||||
)
|
||||
await db.conn.execute("DELETE FROM contacts WHERE public_key = ?", (normalized,))
|
||||
await db.conn.commit()
|
||||
|
||||
Reference in New Issue
Block a user