1
Fork 0

Make massive progress towards deployment

This commit is contained in:
prescientmoon 2025-02-11 05:55:57 +01:00
parent ce18db3d14
commit 489568650a
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
62 changed files with 2868 additions and 1311 deletions
migrations
01-create-users-table
02-create-charts-and-songs
05-metadata

View file

@ -2,35 +2,8 @@
create table IF NOT EXISTS users (
id INTEGER NOT NULL PRIMARY KEY,
discord_id TEXT UNIQUE NOT NULL,
is_pookie BOOL NOT NULL DEFAULT 0
private_server_id INTEGER,
is_pookie BOOL NOT NULL DEFAULT 0,
is_admin BOOL NOT NULL DEFAULT 0
);
-- }}}
-- {{{ plays
CREATE TABLE IF NOT EXISTS plays (
id INTEGER NOT NULL PRIMARY KEY,
chart_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
discord_attachment_id TEXT,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
max_recall INTEGER,
far_notes INTEGER,
FOREIGN KEY (chart_id) REFERENCES charts(id),
FOREIGN KEY (user_id) REFERENCES users(id)
);
-- }}}
-- {{{ scores
CREATE TABLE IF NOT EXISTS scores (
id INTEGER NOT NULL PRIMARY KEY,
play_id INTEGER NOT NULL,
score INTEGER NOT NULL,
creation_ptt INTEGER,
scoring_system TEXT NOT NULL CHECK (scoring_system IN ('standard', 'sdf', 'ex')),
FOREIGN KEY (play_id) REFERENCES plays(id),
UNIQUE(play_id, scoring_system)
)
-- }}}

View file

@ -1,11 +1,11 @@
-- {{{ songs
CREATE TABLE IF NOT EXISTS songs (
id INTEGER NOT NULL PRIMARY KEY,
shorthand TEXT NOT NULL UNIQUE,
title TEXT NOT NULL,
artist TEXT NOT NULL,
side TEXT NOT NULL CHECK (side IN ('light', 'conflict', 'silent')),
side TEXT NOT NULL CHECK (side IN ('light', 'conflict', 'silent', 'lephon')),
bpm TEXT NOT NULL,
pack TEXT,
UNIQUE(title, artist)
);
@ -14,8 +14,8 @@ CREATE TABLE IF NOT EXISTS songs (
CREATE TABLE IF NOT EXISTS charts (
id INTEGER NOT NULL PRIMARY KEY,
song_id INTEGER NOT NULL,
title TEXT,
note_design TEXT,
shorthand TEXT,
difficulty TEXT NOT NULL CHECK (difficulty IN ('PST','PRS','FTR','ETR','BYD')),
level TEXT NOT NULL,

View file

@ -5,8 +5,13 @@ CREATE TABLE IF NOT EXISTS metadata (
-- The last hash computed for the directory
-- containing all the raw jackets. If this
-- hash changes, every jacket is reprocessed.
raw_jackets_hash TEXT NOT NULL
raw_jackets_hash TEXT DEFAULT "" NOT NULL,
-- If any of these files change, every chart/song is reprocessed
songlist_hash TEXT DEFAULT "" NOT NULL,
cc_data_hash TEXT DEFAULT "" NOT NULL,
notecount_hash TEXT DEFAULT "" NOT NULL
) STRICT;
-- Inserts initial metadata row
INSERT INTO metadata VALUES(0, "");
INSERT INTO metadata(id) VALUES(0);