-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-galeri.sql
More file actions
23 lines (18 loc) · 783 Bytes
/
setup-galeri.sql
File metadata and controls
23 lines (18 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- Galeri table
create table if not exists public.galeri (
id uuid primary key default gen_random_uuid(),
title text not null,
link text not null,
image_url text not null,
taken_at date not null,
created_by uuid references auth.users(id) on delete set null,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
alter table public.galeri enable row level security;
create policy "galeri_public_read" on public.galeri
for select to public using (true);
create policy "galeri_auth_insert" on public.galeri
for insert to authenticated with check (auth.uid() = created_by);
create policy "galeri_auth_update" on public.galeri
for update to authenticated using (auth.uid() = created_by) with check (auth.uid() = created_by);