Added playlists tables

This commit is contained in:
Antoine Gersant 2017-07-09 15:47:57 -07:00
parent eb5900fb7d
commit d184802130
3 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,2 @@
DROP TABLE playlists;
DROP TABLE playlist_songs;

View file

@ -0,0 +1,17 @@
CREATE TABLE playlists (
id INTEGER PRIMARY KEY NOT NULL,
owner INTEGER NOT NULL,
name TEXT NOT NULL,
FOREIGN KEY(owner) REFERENCES users(id) ON DELETE CASCADE,
UNIQUE(owner, name)
);
CREATE TABLE playlist_songs (
id INTEGER PRIMARY KEY NOT NULL,
playlist INTEGER NOT NULL,
path TEXT NOT NULL,
ordering INTEGER NOT NULL,
FOREIGN KEY(path) REFERENCES songs(path) ON DELETE NO ACTION,
FOREIGN KEY(playlist) REFERENCES playlists(id) ON DELETE CASCADE,
UNIQUE(playlist, ordering)
);

Binary file not shown.