diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2024-06-24 16:46:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 16:46:19 +0100 |
commit | 9e36f63c6edbd7d675202e873716de9748928b59 (patch) | |
tree | 4635afe0c5e06bd81708ae4d0ff3cc79c0f40f44 | |
parent | 67d64ec4b368c48188c746f2dba2967ec4615fe5 (diff) |
fix: ensure we cleanup all tables when deleting (#2191)
-rw-r--r-- | crates/atuin-server-postgres/src/lib.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/atuin-server-postgres/src/lib.rs b/crates/atuin-server-postgres/src/lib.rs index 7aa874249..e28b6e094 100644 --- a/crates/atuin-server-postgres/src/lib.rs +++ b/crates/atuin-server-postgres/src/lib.rs @@ -401,13 +401,19 @@ impl Database for Postgres { .await .map_err(fix_error)?; - sqlx::query("delete from users where id = $1") + sqlx::query("delete from history where user_id = $1") .bind(u.id) .execute(&self.pool) .await .map_err(fix_error)?; - sqlx::query("delete from history where user_id = $1") + sqlx::query("delete from store where user_id = $1") + .bind(u.id) + .execute(&self.pool) + .await + .map_err(fix_error)?; + + sqlx::query("delete from user_verification_token where user_id = $1") .bind(u.id) .execute(&self.pool) .await @@ -419,6 +425,12 @@ impl Database for Postgres { .await .map_err(fix_error)?; + sqlx::query("delete from users where id = $1") + .bind(u.id) + .execute(&self.pool) + .await + .map_err(fix_error)?; + Ok(()) } |