create database layout

This commit is contained in:
Erik Foris 2021-06-07 17:16:47 +00:00
parent 850e736b3c
commit 663fbd12fd
6 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,8 @@
-- external_servers_preferences definition
CREATE TABLE external_servers_preferences (
id INTEGER NOT NULL,
external_servers BLOB NOT NULL,
external_servers_limit TEXT NOT NULL,
CONSTRAINT external_servers_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
);

View File

@ -0,0 +1,16 @@
-- external_servers_privacy_preferences definition
CREATE TABLE external_servers_privacy_preferences (
id INTEGER NOT NULL,
discovery BLOB NOT NULL,
discovery_user_limit TEXT NOT NULL,
discovery_server_limit TEXT NOT NULL,
last_seen BLOB NOT NULL,
last_seen_user_limit TEXT NOT NULL,
last_seen_server_limit TEXT NOT NULL,
last_seen_course INTEGER DEFAULT 0 NOT NULL,
info BLOB NOT NULL,
info_user_limit TEXT NOT NULL,
info_server_limit TEXT NOT NULL,
CONSTRAINT external_servers_privacy_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
);

View File

@ -0,0 +1,8 @@
-- notification_preferences definition
CREATE TABLE notification_preferences (
id INTEGER NOT NULL,
lock_details INTEGER DEFAULT 0 NOT NULL,
do_not_disturb INTEGER DEFAULT 0 NOT NULL,
CONSTRAINT notification_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
);

View File

@ -0,0 +1,16 @@
-- privacy_preferences definition
CREATE TABLE privacy_preferences (
id INTEGER NOT NULL,
discovery BLOB NOT NULL,
discovery_user_limit TEXT NOT NULL,
discovery_server_limit TEXT NOT NULL,
last_seen BLOB NOT NULL,
last_seen_user_limit TEXT NOT NULL,
last_seen_server_limit TEXT NOT NULL,
last_seen_course INTEGER DEFAULT 0 NOT NULL,
info BLOB NOT NULL,
info_user_limit TEXT NOT NULL,
info_server_limit TEXT NOT NULL,
CONSTRAINT privacy_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
);

View File

@ -0,0 +1,8 @@
-- security_preferences definition
CREATE TABLE "security_preferences" (
id INTEGER NOT NULL,
account_tokens TEXT NOT NULL,
password_hash TEXT NOT NULL,
CONSTRAINT NewTable_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
);

10
sqlite/users.sql Normal file
View File

@ -0,0 +1,10 @@
-- users definition
CREATE TABLE users (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
user_name TEXT NOT NULL,
display_name TEXT,
activated INTEGER DEFAULT 0 NOT NULL,
created INTEGER NOT NULL,
last_online INTEGER
);