2023-05-06 04:24:49 +00:00
|
|
|
--
|
2024-08-19 07:39:50 +00:00
|
|
|
-- File generated with SQLiteStudio v3.4.4 on Mon. Aug. 19 01:39:05 2024
|
2023-05-06 04:24:49 +00:00
|
|
|
--
|
|
|
|
-- Text encoding used: UTF-8
|
|
|
|
--
|
|
|
|
PRAGMA foreign_keys = off;
|
|
|
|
BEGIN TRANSACTION;
|
|
|
|
|
|
|
|
-- Table: categories
|
|
|
|
DROP TABLE IF EXISTS categories;
|
2024-08-19 07:39:50 +00:00
|
|
|
CREATE TABLE 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
|
|
|
|
DROP TABLE IF EXISTS posts;
|
2023-05-17 04:18:25 +00:00
|
|
|
CREATE TABLE 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
|
|
|
|
DROP TABLE IF EXISTS sessions;
|
2023-05-08 10:26:11 +00:00
|
|
|
CREATE TABLE 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
|
|
|
);
|
|
|
|
|
2023-05-06 06:02:47 +00:00
|
|
|
-- Table: subforums
|
|
|
|
DROP TABLE IF EXISTS subforums;
|
2024-08-19 07:39:50 +00:00
|
|
|
CREATE TABLE subforums (subf_id TEXT (1, 5) PRIMARY KEY UNIQUE ON CONFLICT ROLLBACK NOT NULL ON CONFLICT ROLLBACK, subf_cat INTEGER REFERENCES categories (cat_id) NOT NULL, subf_rank INTEGER NOT NULL, subf_name TEXT NOT NULL ON CONFLICT ROLLBACK, subf_desc TEXT);
|
2023-05-06 06:02:47 +00:00
|
|
|
|
2023-05-06 04:24:49 +00:00
|
|
|
-- Table: threads
|
|
|
|
DROP TABLE IF EXISTS threads;
|
2024-08-19 07:39:50 +00:00
|
|
|
CREATE TABLE threads (thread_id INTEGER NOT NULL ON CONFLICT ROLLBACK, thread_title TEXT NOT NULL ON CONFLICT ROLLBACK, thread_subf TEXT (1, 5) 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
|
|
|
|
DROP TABLE IF EXISTS users;
|
2023-05-08 10:26:11 +00:00
|
|
|
CREATE TABLE 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
|
|
|
|
);
|
|
|
|
|
2023-05-06 04:24:49 +00:00
|
|
|
COMMIT TRANSACTION;
|
|
|
|
PRAGMA foreign_keys = on;
|