-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
60 lines (47 loc) · 2.08 KB
/
schema.sql
File metadata and controls
60 lines (47 loc) · 2.08 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- ============================================================
-- Supabase SQL — Run this in the Supabase SQL Editor
-- ============================================================
-- 1. Registered attendees table
-- Matches columns imported from Excel via import-attendees.js
-- ============================================================
create table if not exists registered_attendees (
id uuid primary key default gen_random_uuid(),
name text,
email text unique,
phone text unique, -- E.164 format: +919876543210
about_me text,
designation text,
domain text,
self_description text,
years_of_experience integer,
most_impressive_build text,
created_at timestamptz default now()
);
-- Indexes for fast login verification
create index if not exists idx_attendees_email on registered_attendees(email);
create index if not exists idx_attendees_phone on registered_attendees(phone);
-- ============================================================
-- 2. Row Level Security
-- ============================================================
alter table registered_attendees enable row level security;
-- Anon key can SELECT (needed for login verification check)
create policy "allow_anon_read"
on registered_attendees
for select
using (true);
-- Only service-role can insert/update/delete (import script uses service key)
-- ============================================================
-- 3. Match sessions — stores who matched with whom
-- ============================================================
create table if not exists match_sessions (
id uuid primary key default gen_random_uuid(),
user_id uuid references auth.users(id) on delete cascade,
matched_with uuid references registered_attendees(id),
score numeric(5,2),
created_at timestamptz default now()
);
alter table match_sessions enable row level security;
create policy "users_own_matches"
on match_sessions
for all
using (auth.uid() = user_id);