-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
51 lines (42 loc) · 1.64 KB
/
init.sql
File metadata and controls
51 lines (42 loc) · 1.64 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 EXTENSION IF NOT EXISTS vector;
CREATE TABLE IF NOT EXISTS users (
user_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email VARCHAR(100) UNIQUE NOT NULL,
name VARCHAR(50) NOT NULL,
password_hash VARCHAR(255) NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS notebooks (
notebook_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
notebook_owner UUID NOT NULL,
notebook_name VARCHAR(255) NOT NULL,
pdf_storage_dir VARCHAR(255) NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS chats (
chat_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
parent_notebook UUID NOT NULL,
chat_name VARCHAR(30) NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS documents (
document_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
parent_notebook UUID NOT NULL,
document_name VARCHAR(255) NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
-- table to store arxiv document metadata
CREATE TABLE IF NOT EXISTS arxiv_documents (
arxiv_id VARCHAR(30) PRIMARY KEY,
summary TEXT NOT NULL,
name VARCHAR(100) NOT NULL
);
CREATE TABLE IF NOT EXISTS message_history (
message_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
parent_chat UUID NOT NULL,
user_prompt TEXT NOT NULL,
llm_response TEXT,
creation_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);