-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtable-setup.sql
More file actions
48 lines (44 loc) · 1.18 KB
/
Copy pathtable-setup.sql
File metadata and controls
48 lines (44 loc) · 1.18 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
-- Create the users table
CREATE TABLE users (
phone_number TEXT PRIMARY KEY,
name TEXT,
email TEXT,
created_at TIMESTAMPTZ
);
-- Create the long_term_memory table
CREATE TABLE long_term_memory (
id SERIAL PRIMARY KEY,
user_phone_number TEXT REFERENCES users(phone_number),
conversation_id TEXT REFERENCES conversations(conversation_id),
context TEXT,
embedding VECTOR,
created_at TIMESTAMPTZ
);
-- Create the bookings table
CREATE TABLE bookings (
booking_id TEXT PRIMARY KEY,
phone_number TEXT REFERENCES users(phone_number),
conversation_id TEXT REFERENCES conversations(conversation_id),
booking_state TEXT,
booking_time TIMESTAMPTZ,
booking_email TEXT,
created_at TIMESTAMPTZ
);
-- Create the conversations table
CREATE TABLE conversations (
conversation_id TEXT PRIMARY KEY,
phone_number TEXT REFERENCES users(phone_number),
full_dialogue TEXT,
summary TEXT,
start_timestamp TIMESTAMPTZ,
end_timestamp TIMESTAMPTZ,
last_question TEXT,
last_answer TEXT
);
-- Create the documents table
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
context TEXT,
embedding VECTOR,
metadata JSONB
);