-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.sql
More file actions
28 lines (26 loc) · 969 Bytes
/
Copy pathschema.sql
File metadata and controls
28 lines (26 loc) · 969 Bytes
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
-- Represents watched channels (long-term workspaces)
CREATE TABLE IF NOT EXISTS channels (
channel_id INTEGER PRIMARY KEY,
category_id INTEGER,
category_name TEXT,
channel_name TEXT NOT NULL,
channel_summary TEXT DEFAULT '',
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Represents active Discord threads mapping to ChatGPT chat sessions
CREATE TABLE IF NOT EXISTS threads (
thread_id INTEGER PRIMARY KEY,
channel_id INTEGER NOT NULL,
chatgpt_chat_id TEXT NOT NULL,
thread_title TEXT,
thread_summary TEXT DEFAULT '',
message_count INTEGER DEFAULT 0,
last_active TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (channel_id) REFERENCES channels(channel_id) ON DELETE CASCADE
);
-- Whitelist / Registration table to limit the bot to 5 distinct users
CREATE TABLE IF NOT EXISTS registered_users (
user_id INTEGER PRIMARY KEY,
username TEXT,
registered_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);