-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
77 lines (72 loc) · 1.92 KB
/
schema.sql
File metadata and controls
77 lines (72 loc) · 1.92 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
-- Chainlit SQLAlchemyDataLayer schema, SQLite dialect.
-- Adapted from the Postgres-flavoured upstream schema (UUID -> TEXT,
-- JSONB -> TEXT, TEXT[] -> TEXT, BOOLEAN -> INTEGER). SQLite stores JSON
-- as text; type affinity makes this transparent.
CREATE TABLE IF NOT EXISTS users (
"id" TEXT PRIMARY KEY,
"identifier" TEXT NOT NULL UNIQUE,
"metadata" TEXT NOT NULL,
"createdAt" TEXT
);
CREATE TABLE IF NOT EXISTS threads (
"id" TEXT PRIMARY KEY,
"createdAt" TEXT,
"name" TEXT,
"userId" TEXT,
"userIdentifier" TEXT,
"tags" TEXT,
"metadata" TEXT,
FOREIGN KEY ("userId") REFERENCES users("id") ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS steps (
"id" TEXT PRIMARY KEY,
"name" TEXT NOT NULL,
"type" TEXT NOT NULL,
"threadId" TEXT NOT NULL,
"parentId" TEXT,
"streaming" INTEGER NOT NULL,
"waitForAnswer" INTEGER,
"isError" INTEGER,
"metadata" TEXT,
"tags" TEXT,
"input" TEXT,
"output" TEXT,
"createdAt" TEXT,
"command" TEXT,
"start" TEXT,
"end" TEXT,
"generation" TEXT,
"showInput" TEXT,
"language" TEXT,
"indent" INTEGER,
"defaultOpen" INTEGER,
"autoCollapse" INTEGER,
"icon" TEXT,
"modes" TEXT,
FOREIGN KEY ("threadId") REFERENCES threads("id") ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS elements (
"id" TEXT PRIMARY KEY,
"threadId" TEXT,
"type" TEXT,
"url" TEXT,
"chainlitKey" TEXT,
"name" TEXT NOT NULL,
"display" TEXT,
"objectKey" TEXT,
"size" TEXT,
"page" INTEGER,
"language" TEXT,
"forId" TEXT,
"mime" TEXT,
"props" TEXT,
FOREIGN KEY ("threadId") REFERENCES threads("id") ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS feedbacks (
"id" TEXT PRIMARY KEY,
"forId" TEXT NOT NULL,
"threadId" TEXT NOT NULL,
"value" INTEGER NOT NULL,
"comment" TEXT,
FOREIGN KEY ("threadId") REFERENCES threads("id") ON DELETE CASCADE
);