SupabaseS
Supabase•2y ago
Mr Void

declare unique property in `raw_user_meta_data`

Is it possible to declare a property in raw_user_meta_data as unique ?

I wish to make the username property unique.

I thought about simply making the public.users.username field unique and occasionally make a select request to see whether such username is occupied. But if someone fakes a client, they could bypass that step.

šŸ¤” As I'm writing this, Im thinking I should probably setup a trigger that BEFORE the insertion it runs a function that checks whether a user with that username exists. Although not sure if insertion can be cancelled this way.
Is that a possibilty?
image.png
Was this page helpful?