Changed playlist storage to use a link table instead of embedded list.

This commit is contained in:
Jonathan Bernard 2016-02-07 22:21:59 -06:00
parent 84711a95fe
commit e2ba4ab08b

View File

@ -15,10 +15,18 @@ CREATE TABLE tags (
CREATE TABLE playlists ( CREATE TABLE playlists (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
name VARCHAR NOT NULL, name VARCHAR NOT NULL,
media_file_ids INTEGER[] NOT NULL,
mod_count INTEGER NOT NULL DEFAULT 0 mod_count INTEGER NOT NULL DEFAULT 0
); );
CREATE TABLE playlists_media_files (
playlist_id INTEGER NOT NULL,
media_file_id INTEGER NOT NULL,
position INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (playlist_id) REFERENCES playlists(id),
FOREIGN KEY (media_file_id) REFERENCES media_files(id),
PRIMARY KEY (playlist_id, media_file_id)
);
CREATE TABLE bookmarks ( CREATE TABLE bookmarks (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
name VARCHAR, name VARCHAR,