2023-05-06 04:24:49 +00:00
|
|
|
--
|
2024-08-24 05:33:38 +00:00
|
|
|
-- File generated with SQLiteStudio v3.4.4 on Fri. Aug. 23 23:32:02 2024
|
2023-05-06 04:24:49 +00:00
|
|
|
--
|
|
|
|
-- Text encoding used: UTF-8
|
|
|
|
--
|
|
|
|
PRAGMA foreign_keys = off;
|
|
|
|
BEGIN TRANSACTION;
|
|
|
|
|
|
|
|
-- Table: categories
|
2024-08-24 05:33:38 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS categories (
|
|
|
|
cat_id INTEGER NOT NULL ON CONFLICT ROLLBACK
|
|
|
|
UNIQUE ON CONFLICT ROLLBACK,
|
|
|
|
cat_rank INTEGER NOT NULL,
|
|
|
|
cat_name TEXT,
|
|
|
|
PRIMARY KEY (
|
|
|
|
cat_id
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2023-05-06 04:24:49 +00:00
|
|
|
|
|
|
|
-- Table: posts
|
2024-08-24 05:33:38 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS posts (
|
|
|
|
post_id INTEGER NOT NULL ON CONFLICT ROLLBACK
|
|
|
|
UNIQUE ON CONFLICT ROLLBACK,
|
|
|
|
user_id INTEGER NOT NULL ON CONFLICT ROLLBACK,
|
|
|
|
thread_id INTEGER NOT NULL ON CONFLICT ROLLBACK,
|
|
|
|
post_date INTEGER NOT NULL ON CONFLICT ROLLBACK,
|
|
|
|
post_body TEXT NOT NULL,
|
|
|
|
PRIMARY KEY (
|
|
|
|
post_id AUTOINCREMENT
|
|
|
|
),
|
|
|
|
FOREIGN KEY (
|
|
|
|
user_id
|
|
|
|
)
|
|
|
|
REFERENCES users (user_id),
|
|
|
|
FOREIGN KEY (
|
|
|
|
thread_id
|
|
|
|
)
|
|
|
|
REFERENCES threads (thread_id)
|
|
|
|
);
|
|
|
|
|
2023-05-07 06:04:15 +00:00
|
|
|
|
|
|
|
-- Table: sessions
|
2024-08-24 05:33:38 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS sessions (
|
2023-05-07 06:04:15 +00:00
|
|
|
session_key TEXT NOT NULL
|
2023-05-08 10:26:11 +00:00
|
|
|
UNIQUE
|
|
|
|
PRIMARY KEY,
|
|
|
|
user_id INTEGER REFERENCES users (user_id)
|
|
|
|
NOT NULL,
|
2023-05-07 06:04:15 +00:00
|
|
|
session_expiry NUMERIC NOT NULL,
|
|
|
|
is_ip_bound INTEGER (1, 1) NOT NULL
|
|
|
|
DEFAULT (0),
|
|
|
|
bound_ip TEXT
|
2023-05-06 04:24:49 +00:00
|
|
|
);
|
|
|
|
|
2024-08-24 05:33:38 +00:00
|
|
|
|
2023-05-06 06:02:47 +00:00
|
|
|
-- Table: subforums
|
2024-08-24 05:33:38 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS subforums (
|
|
|
|
subf_id INTEGER,
|
|
|
|
subf_cat INTEGER,
|
|
|
|
subf_rank INTEGER,
|
|
|
|
subf_name TEXT,
|
|
|
|
subf_desc TEXT,
|
|
|
|
PRIMARY KEY (
|
|
|
|
subf_id AUTOINCREMENT
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2023-05-06 06:02:47 +00:00
|
|
|
|
2023-05-06 04:24:49 +00:00
|
|
|
-- Table: threads
|
2024-08-24 05:33:38 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS threads (
|
|
|
|
thread_id INTEGER NOT NULL ON CONFLICT ROLLBACK,
|
|
|
|
thread_title TEXT NOT NULL ON CONFLICT ROLLBACK,
|
|
|
|
thread_subf INTEGER NOT NULL
|
|
|
|
REFERENCES categories (cat_id),
|
|
|
|
PRIMARY KEY (
|
|
|
|
thread_id AUTOINCREMENT
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2023-05-07 06:04:15 +00:00
|
|
|
|
2023-05-06 04:24:49 +00:00
|
|
|
-- Table: users
|
2024-08-24 05:33:38 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS users (
|
2023-05-07 06:04:15 +00:00
|
|
|
user_id INTEGER NOT NULL ON CONFLICT ROLLBACK
|
|
|
|
UNIQUE ON CONFLICT ROLLBACK,
|
|
|
|
username TEXT NOT NULL ON CONFLICT ROLLBACK
|
|
|
|
UNIQUE ON CONFLICT ROLLBACK,
|
|
|
|
email TEXT UNIQUE ON CONFLICT ROLLBACK
|
|
|
|
NOT NULL ON CONFLICT ROLLBACK,
|
|
|
|
password TEXT NOT NULL ON CONFLICT ROLLBACK,
|
|
|
|
salt TEXT NOT NULL ON CONFLICT ROLLBACK,
|
2023-05-08 10:26:11 +00:00
|
|
|
signup_date INTEGER NOT NULL,
|
2023-05-07 06:04:15 +00:00
|
|
|
PRIMARY KEY (
|
|
|
|
user_id AUTOINCREMENT
|
|
|
|
)
|
|
|
|
ON CONFLICT ABORT
|
|
|
|
);
|
|
|
|
|
2024-08-24 05:33:38 +00:00
|
|
|
|
2023-05-06 04:24:49 +00:00
|
|
|
COMMIT TRANSACTION;
|
|
|
|
PRAGMA foreign_keys = on;
|