diff --git a/service/src/main/sql/migrations/20151209054632-initial-schema-up.sql b/service/src/main/sql/migrations/20151209054632-initial-schema-up.sql index 4ffdc29..779032b 100644 --- a/service/src/main/sql/migrations/20151209054632-initial-schema-up.sql +++ b/service/src/main/sql/migrations/20151209054632-initial-schema-up.sql @@ -15,10 +15,18 @@ CREATE TABLE tags ( CREATE TABLE playlists ( id SERIAL PRIMARY KEY, name VARCHAR NOT NULL, - media_file_ids INTEGER[] NOT NULL, 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 ( id SERIAL PRIMARY KEY, name VARCHAR,