-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
43 lines (40 loc) · 1.33 KB
/
Copy pathschema.sql
File metadata and controls
43 lines (40 loc) · 1.33 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
CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE algorithms (
algorithm_id SERIAL PRIMARY KEY,
title VARCHAR(100) NOT NULL,
description TEXT,
category VARCHAR(50),
complexity_notation VARCHAR(20),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_by INTEGER REFERENCES users(user_id),
neutrosophic_truth JSONB,
neutrosophic_indeterminacy JSONB,
neutrosophic_falsehood JSONB
);
CREATE TABLE algorithm_steps (
step_id SERIAL PRIMARY KEY,
algorithm_id INTEGER REFERENCES algorithms(algorithm_id),
step_number INTEGER NOT NULL,
description TEXT NOT NULL,
code_snippet TEXT,
visualization_data JSONB,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
neutrosophic_truth JSONB,
neutrosophic_indeterminacy JSONB,
neutrosophic_falsehood JSONB
);
CREATE TABLE user_progress (
progress_id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(user_id),
algorithm_id INTEGER REFERENCES algorithms(algorithm_id),
completed_steps INTEGER DEFAULT 0,
is_completed BOOLEAN DEFAULT FALSE,
last_accessed TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(user_id, algorithm_id)
);