Hey everyone, I have question regarding the polici...
# help
k
Hey everyone, I have question regarding the policies, first case is that i want to have one superadmin who can do all operations, how can I achieve that?
j
your probably better creating a 'user_roles' table in your db.
Copy code
sql
-- Custom types
create type public.app_role as enum ('superadmin', 'admin');

-- USER ROLES
create table public.user_roles (
  id        bigint generated by default as identity primary key,
  user_id   uuid references public.users on delete cascade not null,
  role      app_role not null,
  unique (user_id, role)
);

comment on table public.user_roles is 'Application roles for each user.';
there's more to read up on this here: https://github.com/supabase/supabase/tree/master/examples/nextjs-slack-clone#postgres-row-level-security