Skip to content

Commit f874856

Browse files
triphorafetchfern
andauthored
Fix user deletion with new notifications_deliveries table for real (#4473)
Maybe this will work? I dunno but users are still saying they're getting errors deleting accs. In theory it shouldn't matter if the transaction all gets committed at the same time, though, right? I can't really test this so I would like someone to tell me whether this will actually make a difference. Co-authored-by: François-X. T <[email protected]>
1 parent b96c5cd commit f874856

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

apps/labrinth/src/database/models/user_item.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,18 +561,18 @@ impl DBUser {
561561

562562
sqlx::query!(
563563
"
564-
DELETE FROM notifications
565-
WHERE user_id = $1
564+
DELETE FROM notifications_actions
565+
WHERE notification_id = ANY($1)
566566
",
567-
id as DBUserId,
567+
&notifications
568568
)
569569
.execute(&mut **transaction)
570570
.await?;
571571

572572
sqlx::query!(
573573
"
574-
DELETE FROM notifications_actions
575-
WHERE notification_id = ANY($1)
574+
DELETE FROM notifications_deliveries
575+
WHERE notification_id = ANY($1)
576576
",
577577
&notifications
578578
)
@@ -581,10 +581,10 @@ impl DBUser {
581581

582582
sqlx::query!(
583583
"
584-
DELETE FROM notifications_deliveries
585-
WHERE notification_id = ANY($1)
584+
DELETE FROM notifications
585+
WHERE user_id = $1
586586
",
587-
&notifications
587+
id as DBUserId,
588588
)
589589
.execute(&mut **transaction)
590590
.await?;

0 commit comments

Comments
 (0)