kresimirgalic
01/07/2022, 12:24 PMjonny
01/07/2022, 7:01 PMsql
-- 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