-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
23 lines (20 loc) · 691 Bytes
/
init.sql
File metadata and controls
23 lines (20 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- script that was ran in Supabase SQL editor
-- for documentation purposes only
create table public.tickets (
id uuid default gen_random_uuid() primary key,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
-- link DIRECTLY to the hidden Supabase auth user
user_id uuid references auth.users not null,
-- payment data
stripe_session_id text unique,
amount_paid numeric,
-- qr code content
ticket_code uuid default gen_random_uuid() not null,
-- status
status text default 'valid'
);
alter table tickets enable row level security;
create policy "Users can view own tickets"
on tickets
for select
using (auth.uid () = user_id);