Files
supabase/docker/dev/data.sql
Copple 614faed4e4 Chore/postgrest v9 (#3988)
* using slack clone to test

* updates auth functions to handle new GUC commands

* move postgREST to new version

* testing with todo list

* makeing our mount setup far more robust

* Adds some usage commands

* cleans up the auth functions

* test with todos app

* fix env var for GUC

* new auth functions - changed for performance improvement

* Adds some integration tests for RLS

* anon volume on postgres

* remove unused helpers

* fix broken docusaurus build

* Fix complaining vercel

* test instructions

* Use named imports

* Fixes imports

* all relative

* chore: add in tsconfig.json to /web

* finding these all over the place

* Update docker/docker-compose.yml

Co-authored-by: Steve Chavez <stevechavezast@gmail.com>

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Steve Chavez <stevechavezast@gmail.com>
2021-11-24 00:31:07 +08:00

49 lines
1.2 KiB
PL/PgSQL

create table profiles (
id uuid references auth.users not null,
updated_at timestamp with time zone,
username text unique,
avatar_url text,
website text,
primary key (id),
unique(username),
constraint username_length check (char_length(username) >= 3)
);
alter table profiles enable row level security;
create policy "Public profiles are viewable by the owner."
on profiles for select
using ( auth.uid() = id );
create policy "Users can insert their own profile."
on profiles for insert
with check ( auth.uid() = id );
create policy "Users can update own profile."
on profiles for update
using ( auth.uid() = id );
-- Set up Realtime
begin;
drop publication if exists supabase_realtime;
create publication supabase_realtime;
commit;
alter publication supabase_realtime add table profiles;
-- Set up Storage
insert into storage.buckets (id, name)
values ('avatars', 'avatars');
create policy "Avatar images are publicly accessible."
on storage.objects for select
using ( bucket_id = 'avatars' );
create policy "Anyone can upload an avatar."
on storage.objects for insert
with check ( bucket_id = 'avatars' );
create policy "Anyone can update an avatar."
on storage.objects for update
with check ( bucket_id = 'avatars' );