Implementing soft delete for user accounts - Supabase

Hey everyone,

I would like users on my app to be able to delete their account, but instead of permanently deleting them, I’d like to perform a soft delete, meaning I’ll anonymize their data.

I have two tables to anonymize:

  • The user table in my public schema
  • The user table in my auth schema

So far, I’ve managed to set up a workflow in WeWeb where, when a user clicks “Delete my account,” the app soft deletes their record in the public.user table (via a function).

However, I’m struggling to handle the soft delete for the auth.user table. I’ve read a few different approaches but I’m not sure which one makes the most sense:

  • Using deleteUser() with shouldSoftDelete: true, though I’m not sure how to implement this

  • Creating an Edge Function triggered by the user in WeWeb, though this is tricky since users don’t have delete rights

  • Creating an Edge Function triggered automatically when the public user table is updated (e.g., when the deleted_at column is set)

I’m a bit lost on what makes the most sense. I’m not super familiar with Edge Functions, and what I’ve read so far seems quite technical.

Has anyone done something similar or can recommend the best approach?

Thanks a lot!
Mélanie

Hi Melanie :waving_hand:

This is a super interesting question,

I’m not an expert in Supabase so I’m also interested in knowing how others are solving this problem. :thinking:

Hi! You might want to check out the Supabase Reddit community, they’re usually very responsive and helpful there.

2 Likes