1. Added declarative schemas to Supabase 2. Added Cursor Ignore to ignore some files from Cursor 3. Added Prettier Ignore to ignore some files from Prettier 4. Formatted files so that PG Schema diff won't return any changes
30 lines
838 B
SQL
30 lines
838 B
SQL
/*
|
|
* -------------------------------------------------------
|
|
* Section: Roles
|
|
* We create the schema for the roles. Roles are the roles for an account. For example, an account might have the roles 'owner', 'admin', and 'member'.
|
|
* -------------------------------------------------------
|
|
*/
|
|
|
|
-- Roles Table
|
|
create table if not exists
|
|
public.roles (
|
|
name varchar(50) not null,
|
|
hierarchy_level int not null check (hierarchy_level > 0),
|
|
primary key (name),
|
|
unique (hierarchy_level)
|
|
);
|
|
|
|
-- Revoke all on roles table from authenticated and service_role
|
|
revoke all on public.roles
|
|
from
|
|
authenticated,
|
|
service_role;
|
|
|
|
-- Open up access to roles table for authenticated users and service_role
|
|
grant
|
|
select
|
|
on table public.roles to authenticated,
|
|
service_role;
|
|
|
|
-- RLS
|
|
alter table public.roles enable row level security; |