-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
26 lines (21 loc) · 886 Bytes
/
schema.sql
File metadata and controls
26 lines (21 loc) · 886 Bytes
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
-- RefClock Supabase schema
create table if not exists games (
id uuid primary key default gen_random_uuid(),
user_id uuid not null references auth.users(id) on delete cascade,
created_at timestamptz not null default now(),
home_team text not null,
away_team text not null,
home_score integer not null default 0,
away_score integer not null default 0,
duration_per_half integer not null,
events jsonb not null default '[]',
notes text
);
-- Users can only read/write their own games
alter table games enable row level security;
create policy "owner select" on games
for select using (auth.uid() = user_id);
create policy "owner insert" on games
for insert with check (auth.uid() = user_id);
create policy "owner delete" on games
for delete using (auth.uid() = user_id);