-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.sql
27 lines (23 loc) · 913 Bytes
/
database.sql
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
-- this are some sample tables for an actual db implementation
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
user_id INT NOT NULL,
filename VARCHAR(255) NOT NULL,
document_path VARCHAR(255) NOT NULL, -- Path where the document is stored
upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
status VARCHAR(50) DEFAULT 'uploaded', -- Could be 'uploaded', 'processing', 'completed'
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE TABLE document_summaries (
id SERIAL PRIMARY KEY,
document_id INT NOT NULL,
summary_text TEXT NOT NULL,
summarized_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (document_id) REFERENCES documents(id) ON DELETE CASCADE
);