-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase-schema.sql
More file actions
44 lines (39 loc) · 1.46 KB
/
supabase-schema.sql
File metadata and controls
44 lines (39 loc) · 1.46 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
-- Table 1: Raw webhook logs (stores EVERYTHING that comes in)
CREATE TABLE readai_webhook_logs (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
session_id TEXT,
trigger_type TEXT,
title TEXT,
payload JSONB NOT NULL,
is_customer_meeting BOOLEAN DEFAULT FALSE,
processed_at TIMESTAMPTZ,
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE INDEX idx_webhook_logs_session_id ON readai_webhook_logs(session_id);
-- Table 2: Parsed customer meetings (only external meetings)
CREATE TABLE customer_meetings (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
session_id TEXT UNIQUE NOT NULL,
title TEXT NOT NULL,
meeting_date TIMESTAMPTZ,
duration_minutes INTEGER,
platform TEXT,
report_url TEXT,
owner_name TEXT,
owner_email TEXT,
summary TEXT,
action_items TEXT,
customer_domains TEXT[],
external_participants JSONB,
internal_participants JSONB,
raw_webhook_id UUID REFERENCES readai_webhook_logs(id),
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE INDEX idx_customer_meetings_domains ON customer_meetings USING GIN(customer_domains);
-- Enable Row Level Security (allow all for test env)
ALTER TABLE readai_webhook_logs ENABLE ROW LEVEL SECURITY;
ALTER TABLE customer_meetings ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Service role full access" ON readai_webhook_logs
FOR ALL USING (true) WITH CHECK (true);
CREATE POLICY "Service role full access" ON customer_meetings
FOR ALL USING (true) WITH CHECK (true);