25 lines
749 B
SQL
25 lines
749 B
SQL
DROP TABLE IF EXISTS user;
|
|
DROP TABLE IF EXISTS post;
|
|
DROP TABLE IF EXISTS user_settings;
|
|
|
|
CREATE TABLE user (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
username TEXT UNIQUE NOT NULL,
|
|
password TEXT NOT NULL
|
|
);
|
|
|
|
CREATE TABLE post (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
author_id INTEGER NOT NULL,
|
|
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
title TEXT NOT NULL,
|
|
body TEXT NOT NULL,
|
|
FOREIGN KEY (author_id) REFERENCES user (id)
|
|
);
|
|
|
|
CREATE TABLE user_settings (
|
|
user_id INTEGER PRIMARY KEY AUTOINCREMENT REFERENCES user (id),
|
|
lang VARCHAR(3) NOT NULL, -- e.g. en/jp; may add support for other (possibly 3-long) codes later
|
|
theme VARCHAR(5) NOT NULL, -- "light" or "dark"
|
|
pfp_filename CHAR(36) -- 36-char UUID string
|
|
); |