-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase_schema.sql
More file actions
32 lines (27 loc) · 1.31 KB
/
Copy pathsupabase_schema.sql
File metadata and controls
32 lines (27 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
-- Create Exhibitions Table
create table public.exhibitions (
id uuid default gen_random_uuid() primary key,
title text,
description text,
created_at timestamp with time zone default timezone('utc'::text, now()) not null
);
-- Create Photos Table
create table public.photos (
id uuid default gen_random_uuid() primary key,
exhibition_id uuid references public.exhibitions(id) on delete cascade not null,
url text not null,
caption text,
gap_after integer default 0,
sort_order integer default 0,
created_at timestamp with time zone default timezone('utc'::text, now()) not null
);
-- Enable RLS (Optional but good practice)
alter table public.exhibitions enable row level security;
alter table public.photos enable row level security;
-- Create policies (Allow public read/write for demo purposes)
create policy "Allow public read exhibitions" on public.exhibitions for select using (true);
create policy "Allow public insert exhibitions" on public.exhibitions for insert with check (true);
create policy "Allow public read photos" on public.photos for select using (true);
create policy "Allow public insert photos" on public.photos for insert with check (true);
-- NOTE: You also need to create a Storage Bucket named 'exhibitions' in the Supabase Dashboard
-- and set its policy to "Public" (Select/Insert enabled).