2024-06-22 16:40:56 +02:00
|
|
|
# {{{ users
|
|
|
|
create table IF NOT EXISTS users (
|
2024-06-22 23:07:11 +02:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY,
|
2024-08-12 03:13:41 +02:00
|
|
|
discord_id TEXT UNIQUE NOT NULL,
|
|
|
|
is_pookie BOOL NOT NULL DEFAULT 0
|
2024-06-22 16:40:56 +02:00
|
|
|
);
|
2024-08-20 19:24:32 +02:00
|
|
|
# }}}
|
2024-06-22 16:40:56 +02:00
|
|
|
# {{{ songs
|
|
|
|
CREATE TABLE IF NOT EXISTS songs (
|
2024-06-22 23:07:11 +02:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY,
|
2024-06-22 16:40:56 +02:00
|
|
|
title TEXT NOT NULL,
|
2024-07-01 18:00:03 +02:00
|
|
|
artist TEXT NOT NULL,
|
|
|
|
side TEXT NOT NULL CHECK (side IN ('light', 'conflict', 'silent')),
|
|
|
|
bpm TEXT NOT NULL,
|
|
|
|
pack TEXT,
|
2024-06-22 16:40:56 +02:00
|
|
|
|
|
|
|
UNIQUE(title, artist)
|
|
|
|
);
|
|
|
|
# }}}
|
|
|
|
# {{{ charts
|
|
|
|
CREATE TABLE IF NOT EXISTS charts (
|
2024-06-22 23:07:11 +02:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY,
|
2024-06-22 16:40:56 +02:00
|
|
|
song_id INTEGER NOT NULL,
|
2024-07-01 18:00:03 +02:00
|
|
|
note_design TEXT,
|
|
|
|
shorthand TEXT,
|
2024-06-22 16:40:56 +02:00
|
|
|
|
|
|
|
difficulty TEXT NOT NULL CHECK (difficulty IN ('PST','PRS','FTR','ETR','BYD')),
|
|
|
|
level TEXT NOT NULL,
|
|
|
|
|
|
|
|
note_count INTEGER NOT NULL,
|
|
|
|
chart_constant INTEGER NOT NULL,
|
|
|
|
|
|
|
|
FOREIGN KEY (song_id) REFERENCES songs(id),
|
|
|
|
UNIQUE(song_id, difficulty)
|
|
|
|
);
|
|
|
|
# }}}
|
|
|
|
# {{{ plays
|
|
|
|
CREATE TABLE IF NOT EXISTS plays (
|
2024-06-22 23:07:11 +02:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY,
|
2024-06-22 16:40:56 +02:00
|
|
|
chart_id INTEGER NOT NULL,
|
|
|
|
user_id INTEGER NOT NULL,
|
|
|
|
discord_attachment_id TEXT,
|
|
|
|
|
|
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
creation_ptt INTEGER,
|
|
|
|
creation_zeta_ptt INTEGER,
|
|
|
|
|
|
|
|
score INTEGER NOT NULL,
|
2024-06-27 21:22:44 +02:00
|
|
|
zeta_score INTEGER NOT NULL,
|
2024-06-22 16:40:56 +02:00
|
|
|
|
|
|
|
max_recall INTEGER,
|
|
|
|
far_notes INTEGER,
|
|
|
|
|
|
|
|
FOREIGN KEY (chart_id) REFERENCES charts(id),
|
|
|
|
FOREIGN KEY (user_id) REFERENCES users(id)
|
|
|
|
);
|
|
|
|
# }}}
|
2024-08-20 19:24:32 +02:00
|
|
|
# {{{ 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 NOT NULL CHECK (scoring_system IN ('standard', 'ex')),
|
|
|
|
|
|
|
|
FOREIGN KEY (play_id) REFERENCES plays(id),
|
|
|
|
UNIQUE(play_id, scoring_system)
|
|
|
|
)
|
|
|
|
# }}}
|
2024-06-22 16:40:56 +02:00
|
|
|
|
2024-07-01 18:00:03 +02:00
|
|
|
insert into users(discord_id) values (385759924917108740);
|