2022-08-13 16:28:57 +02:00
|
|
|
DROP TABLE IF EXISTS user;
|
|
|
|
DROP TABLE IF EXISTS partition;
|
|
|
|
DROP TABLE IF EXISTS album;
|
|
|
|
DROP TABLE IF EXISTS contient_partition;
|
|
|
|
DROP TABLE IF EXISTS contient_user;
|
2022-08-17 09:44:31 +02:00
|
|
|
DROP TABLE IF EXISTS search_results;
|
2022-08-13 16:28:57 +02:00
|
|
|
|
|
|
|
CREATE TABLE user (
|
2022-08-13 23:36:10 +02:00
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
username TEXT UNIQUE NOT NULL,
|
|
|
|
password TEXT NOT NULL,
|
2022-08-13 16:28:57 +02:00
|
|
|
access_level INTEGER NOT NULL DEFAULT 0
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE partition (
|
2022-08-13 23:36:10 +02:00
|
|
|
uuid TEXT(36) PRIMARY KEY,
|
|
|
|
name TEXT NOT NULL,
|
2022-08-13 16:28:57 +02:00
|
|
|
author TEXT,
|
2022-12-18 21:39:01 +01:00
|
|
|
body TEXT,
|
2023-08-30 19:50:00 +02:00
|
|
|
user_id INTEGER,
|
|
|
|
source TEXT DEFAULT 'unknown'
|
2022-08-13 16:28:57 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE album (
|
2022-08-13 23:36:10 +02:00
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
uuid TEXT(36) UNIQUE NOT NULL
|
2022-08-13 16:28:57 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE contient_partition (
|
2022-08-13 23:36:10 +02:00
|
|
|
partition_uuid TEXT(36) NOT NULL,
|
2022-08-13 16:28:57 +02:00
|
|
|
album_id INTEGER NOT NULL,
|
2022-08-13 23:36:10 +02:00
|
|
|
PRIMARY KEY (partition_uuid, album_id)
|
2022-08-13 16:28:57 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE contient_user (
|
|
|
|
user_id INTEGER NOT NULL,
|
|
|
|
album_id INTEGER NOT NULL,
|
|
|
|
PRIMARY KEY (user_id, album_id)
|
|
|
|
);
|
2022-08-17 09:44:31 +02:00
|
|
|
|
|
|
|
CREATE TABLE search_results (
|
|
|
|
uuid TEXT(36) PRIMARY KEY,
|
2022-10-28 23:01:02 +02:00
|
|
|
url TEXT,
|
2022-08-17 09:44:31 +02:00
|
|
|
creation_time TEXT NULL DEFAULT (datetime('now', 'localtime'))
|
|
|
|
);
|