From d7863f2a4941021d53f86b567e6f5069c5260689 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Tue, 31 Dec 2024 18:19:11 -0500 Subject: [PATCH] refactor purge to use foreign key cascade --- nomen/settings.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/nomen/settings.py b/nomen/settings.py index dca39af..6e4f2c2 100644 --- a/nomen/settings.py +++ b/nomen/settings.py @@ -37,14 +37,8 @@ You may want to `{ctx.clean_prefix}nomen export` first""" to_purge = await confirm(ctx, msg) if to_purge: - await self.bot.db.execute( - """ - DELETE FROM keywords WHERE user_id=?; - DELETE FROM users WHERE user_id=?; - DELETE FROM user_ignores WHERE user_id=?; - """, - (ctx.author.id,), - ) + # Foreign key constraints will automatically cascade to delete dependent data + await self.bot.db.execute("DELETE FROM users WHERE user_id=?", (ctx.author.id,)) await self.bot.db.commit() await ctx.send("Deleted all user data.") else: