2023-12-11 15:12:51 +00:00
|
|
|
create table public.profiles
|
|
|
|
(
|
|
|
|
id uuid not null references auth.users on delete cascade,
|
|
|
|
username varchar(64),
|
|
|
|
nickname varchar(256),
|
|
|
|
school int8,
|
|
|
|
primary key (id)
|
2023-12-10 13:58:23 +00:00
|
|
|
);
|
2023-12-11 15:12:51 +00:00
|
|
|
|
|
|
|
alter table public.profiles
|
|
|
|
enable row level security;
|
|
|
|
|
2023-12-10 14:54:04 +00:00
|
|
|
create policy "Public profiles are viewable by everyone." on profiles for
|
2023-12-11 15:12:51 +00:00
|
|
|
select using (true);
|
|
|
|
|
2023-12-10 14:54:04 +00:00
|
|
|
create policy "Users can insert their own profile." on profiles for
|
2023-12-11 15:12:51 +00:00
|
|
|
insert with check (auth.uid() = id);
|
|
|
|
|
2023-12-10 14:54:04 +00:00
|
|
|
create policy "Users can update own profile." on profiles for
|
2023-12-11 15:12:51 +00:00
|
|
|
update using (auth.uid() = id);
|