refactor purge to use foreign key cascade
This commit is contained in:
parent
f3b40986be
commit
d7863f2a49
1 changed files with 2 additions and 8 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue