mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-09 11:42:16 +00:00
parent
42c7ca40c4
commit
b438bb0121
@ -16,7 +16,7 @@ DROP INDEX index_rating_folder_rated_id_fk ON rating_folder;
|
||||
|
||||
ALTER TABLE folder
|
||||
ADD int_id INTEGER AFTER id,
|
||||
ADD int_parent_id INTEGER REFERENCES folder AFTER parent_id;
|
||||
ADD int_parent_id INTEGER REFERENCES folder(id) AFTER parent_id;
|
||||
UPDATE folder SET int_id = (SELECT id FROM folder_id_to_int WHERE uuid = folder.id);
|
||||
UPDATE folder SET int_parent_id = (SELECT id FROM folder_id_to_int WHERE uuid = folder.parent_id);
|
||||
ALTER TABLE folder
|
||||
@ -29,8 +29,8 @@ ALTER TABLE folder
|
||||
|
||||
|
||||
ALTER TABLE track
|
||||
ADD int_root_folder_id INTEGER NOT NULL REFERENCES folder AFTER root_folder_id,
|
||||
ADD int_folder_id INTEGER NOT NULL REFERENCES folder AFTER folder_id;
|
||||
ADD int_root_folder_id INTEGER NOT NULL REFERENCES folder(id) AFTER root_folder_id,
|
||||
ADD int_folder_id INTEGER NOT NULL REFERENCES folder(id) AFTER folder_id;
|
||||
UPDATE track SET int_root_folder_id = (SELECT id FROM folder_id_to_int WHERE uuid = track.root_folder_id);
|
||||
UPDATE track SET int_folder_id = (SELECT id FROM folder_id_to_int WHERE uuid = track.folder_id);
|
||||
ALTER TABLE track
|
||||
@ -40,7 +40,7 @@ ALTER TABLE track
|
||||
CHANGE COLUMN int_folder_id folder_id INTEGER NOT NULL;
|
||||
|
||||
|
||||
ALTER TABLE starred_folder ADD int_starred_id INTEGER NOT NULL REFERENCES folder AFTER starred_id;
|
||||
ALTER TABLE starred_folder ADD int_starred_id INTEGER NOT NULL REFERENCES folder(id) AFTER starred_id;
|
||||
UPDATE starred_folder SET int_starred_id = (SELECT id FROM folder_id_to_int WHERE uuid = starred_folder.starred_id);
|
||||
ALTER TABLE starred_folder
|
||||
DROP PRIMARY KEY,
|
||||
@ -49,7 +49,7 @@ ALTER TABLE starred_folder
|
||||
ADD PRIMARY KEY (user_id, starred_id);
|
||||
|
||||
|
||||
ALTER TABLE rating_folder ADD int_rated_id INTEGER NOT NULL REFERENCES folder AFTER rated_id;
|
||||
ALTER TABLE rating_folder ADD int_rated_id INTEGER NOT NULL REFERENCES folder(id) AFTER rated_id;
|
||||
UPDATE rating_folder SET int_rated_id = (SELECT id FROM folder_id_to_int WHERE uuid = rating_folder.rated_id);
|
||||
ALTER TABLE rating_folder
|
||||
DROP PRIMARY KEY,
|
||||
|
@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS folder (
|
||||
created DATETIME NOT NULL,
|
||||
cover_art VARCHAR(256),
|
||||
last_scan INTEGER NOT NULL,
|
||||
parent_id INTEGER REFERENCES folder
|
||||
parent_id INTEGER REFERENCES folder(id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE INDEX index_folder_parent_id_fk ON folder(parent_id);
|
||||
|
||||
@ -19,7 +19,7 @@ CREATE TABLE IF NOT EXISTS artist (
|
||||
CREATE TABLE IF NOT EXISTS album (
|
||||
id BINARY(16) PRIMARY KEY,
|
||||
name VARCHAR(256) NOT NULL,
|
||||
artist_id BINARY(16) NOT NULL REFERENCES artist
|
||||
artist_id BINARY(16) NOT NULL REFERENCES artist(id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE INDEX index_album_artist_id_fk ON album(artist_id);
|
||||
|
||||
@ -32,8 +32,8 @@ CREATE TABLE IF NOT EXISTS track (
|
||||
genre VARCHAR(256),
|
||||
duration INTEGER NOT NULL,
|
||||
has_art BOOLEAN NOT NULL DEFAULT false,
|
||||
album_id BINARY(16) NOT NULL REFERENCES album,
|
||||
artist_id BINARY(16) NOT NULL REFERENCES artist,
|
||||
album_id BINARY(16) NOT NULL REFERENCES album(id),
|
||||
artist_id BINARY(16) NOT NULL REFERENCES artist(id),
|
||||
bitrate INTEGER NOT NULL,
|
||||
path VARCHAR(4096) NOT NULL,
|
||||
path_hash BINARY(20) UNIQUE NOT NULL,
|
||||
@ -41,8 +41,8 @@ CREATE TABLE IF NOT EXISTS track (
|
||||
last_modification INTEGER NOT NULL,
|
||||
play_count INTEGER NOT NULL,
|
||||
last_play DATETIME,
|
||||
root_folder_id INTEGER NOT NULL REFERENCES folder,
|
||||
folder_id INTEGER NOT NULL REFERENCES folder
|
||||
root_folder_id INTEGER NOT NULL REFERENCES folder(id),
|
||||
folder_id INTEGER NOT NULL REFERENCES folder(id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE INDEX index_track_album_id_fk ON track(album_id);
|
||||
CREATE INDEX index_track_artist_id_fk ON track(artist_id);
|
||||
@ -59,7 +59,7 @@ CREATE TABLE IF NOT EXISTS user (
|
||||
jukebox BOOLEAN NOT NULL,
|
||||
lastfm_session CHAR(32),
|
||||
lastfm_status BOOLEAN NOT NULL,
|
||||
last_play_id BINARY(16) REFERENCES track,
|
||||
last_play_id BINARY(16) REFERENCES track(id),
|
||||
last_play_date DATETIME
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE INDEX index_user_last_play_id_fk ON user(last_play_id);
|
||||
@ -73,8 +73,8 @@ CREATE TABLE IF NOT EXISTS client_prefs (
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS starred_folder (
|
||||
user_id BINARY(16) NOT NULL REFERENCES user,
|
||||
starred_id INTEGER NOT NULL REFERENCES folder,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user(id),
|
||||
starred_id INTEGER NOT NULL REFERENCES folder(id),
|
||||
date DATETIME NOT NULL,
|
||||
PRIMARY KEY (user_id, starred_id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@ -82,8 +82,8 @@ CREATE INDEX index_starred_folder_user_id_fk ON starred_folder(user_id);
|
||||
CREATE INDEX index_starred_folder_starred_id_fk ON starred_folder(starred_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS starred_artist (
|
||||
user_id BINARY(16) NOT NULL REFERENCES user,
|
||||
starred_id BINARY(16) NOT NULL REFERENCES artist,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user(id),
|
||||
starred_id BINARY(16) NOT NULL REFERENCES artist(id),
|
||||
date DATETIME NOT NULL,
|
||||
PRIMARY KEY (user_id, starred_id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@ -91,8 +91,8 @@ CREATE INDEX index_starred_artist_user_id_fk ON starred_artist(user_id);
|
||||
CREATE INDEX index_starred_artist_starred_id_fk ON starred_artist(starred_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS starred_album (
|
||||
user_id BINARY(16) NOT NULL REFERENCES user,
|
||||
starred_id BINARY(16) NOT NULL REFERENCES album,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user(id),
|
||||
starred_id BINARY(16) NOT NULL REFERENCES album(id),
|
||||
date DATETIME NOT NULL,
|
||||
PRIMARY KEY (user_id, starred_id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@ -100,8 +100,8 @@ CREATE INDEX index_starred_album_user_id_fk ON starred_album(user_id);
|
||||
CREATE INDEX index_starred_album_starred_id_fk ON starred_album(starred_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS starred_track (
|
||||
user_id BINARY(16) NOT NULL REFERENCES user,
|
||||
starred_id BINARY(16) NOT NULL REFERENCES track,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user(id),
|
||||
starred_id BINARY(16) NOT NULL REFERENCES track(id),
|
||||
date DATETIME NOT NULL,
|
||||
PRIMARY KEY (user_id, starred_id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@ -109,8 +109,8 @@ CREATE INDEX index_starred_track_user_id_fk ON starred_track(user_id);
|
||||
CREATE INDEX index_starred_track_starred_id_fk ON starred_track(starred_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rating_folder (
|
||||
user_id BINARY(16) NOT NULL REFERENCES user,
|
||||
rated_id INTEGER NOT NULL REFERENCES folder,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user(id),
|
||||
rated_id INTEGER NOT NULL REFERENCES folder(id),
|
||||
rating INTEGER NOT NULL CHECK(rating BETWEEN 1 AND 5),
|
||||
PRIMARY KEY (user_id, rated_id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@ -118,8 +118,8 @@ CREATE INDEX index_rating_folder_user_id_fk ON rating_folder(user_id);
|
||||
CREATE INDEX index_rating_folder_rated_id_fk ON rating_folder(rated_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rating_track (
|
||||
user_id BINARY(16) NOT NULL REFERENCES user,
|
||||
rated_id BINARY(16) NOT NULL REFERENCES track,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user(id),
|
||||
rated_id BINARY(16) NOT NULL REFERENCES track(id),
|
||||
rating INTEGER NOT NULL CHECK(rating BETWEEN 1 AND 5),
|
||||
PRIMARY KEY (user_id, rated_id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@ -128,7 +128,7 @@ CREATE INDEX index_rating_track_rated_id_fk ON rating_track(rated_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS chat_message (
|
||||
id BINARY(16) PRIMARY KEY,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user(id),
|
||||
time INTEGER NOT NULL,
|
||||
message VARCHAR(512) NOT NULL
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@ -136,7 +136,7 @@ CREATE INDEX index_chat_message_user_id_fk ON chat_message(user_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS playlist (
|
||||
id BINARY(16) PRIMARY KEY,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user,
|
||||
user_id BINARY(16) NOT NULL REFERENCES user(id),
|
||||
name VARCHAR(256) NOT NULL,
|
||||
comment VARCHAR(256),
|
||||
public BOOLEAN NOT NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user