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 /crates/atuin-server-postgres/src | |
| parent | feat: add user account verification (#2190) (diff) | |
| download | atuin-9e36f63c6edbd7d675202e873716de9748928b59.zip | |
fix: ensure we cleanup all tables when deleting (#2191)
Diffstat (limited to '')
| -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 7aa87424..e28b6e09 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(()) } |
