43 lines
1.5 KiB
SQL
43 lines
1.5 KiB
SQL
-- Polderfest 2027 — Supabase schema
|
|
-- Run dit in Supabase SQL Editor voor je het seed script gebruikt.
|
|
|
|
create table if not exists bands (
|
|
id bigserial primary key,
|
|
name text not null,
|
|
genre text not null,
|
|
sub_genre text,
|
|
stage text not null,
|
|
day text not null check (day in ('Vrijdag','Zaterdag','Zondag')),
|
|
start_time text not null, -- "21:30"
|
|
duration_min int not null default 60,
|
|
origin_city text,
|
|
members text[],
|
|
bio text,
|
|
tier text check (tier in ('headliner','mid','opener')),
|
|
popularity int check (popularity between 1 and 100),
|
|
ticket_impact numeric(6,2), -- bijdrage aan ticketprijs als extra
|
|
created_at timestamp default now()
|
|
);
|
|
|
|
-- Maak indexen voor de vragen die we vaak gaan stellen
|
|
create index if not exists idx_bands_day on bands(day);
|
|
create index if not exists idx_bands_stage on bands(stage);
|
|
create index if not exists idx_bands_genre on bands(genre);
|
|
create index if not exists idx_bands_tier on bands(tier);
|
|
|
|
-- RLS (we lezen public, geen edits voor anon)
|
|
alter table bands enable row level security;
|
|
|
|
create policy "Bands zijn publiek leesbaar"
|
|
on bands for select
|
|
using (true);
|
|
|
|
-- Optioneel: tabel voor straks (tool calling demo in Les 12)
|
|
create table if not exists user_favorites (
|
|
id bigserial primary key,
|
|
user_email text not null,
|
|
band_id bigint not null references bands(id) on delete cascade,
|
|
created_at timestamp default now(),
|
|
unique(user_email, band_id)
|
|
);
|