34 lines
630 B
SQL
34 lines
630 B
SQL
-- Up
|
|
|
|
CREATE TABLE Playlist (
|
|
id INTEGER PRIMARY KEY,
|
|
title TEXT
|
|
);
|
|
|
|
CREATE TABLE Track (
|
|
id INTEGER PRIMARY KEY,
|
|
title TEXT,
|
|
artist TEXT,
|
|
file TEXT,
|
|
album TEXT,
|
|
genre TEXT,
|
|
track INTEGER,
|
|
year INTEGER,
|
|
duration INTEGER
|
|
);
|
|
|
|
CREATE TABLE PlaylistEntry (
|
|
id INTEGER PRIMARY KEY,
|
|
playlistId INTEGER,
|
|
trackId INTEGER,
|
|
CONSTRAINT PE_fk_playlistId FOREIGN KEY (playlistId)
|
|
REFERENCES Playlist (id) ON UPDATE CASCADE ON DELETE CASCADE,
|
|
CONSTRAINT PE_fk_trackId FOREIGN KEY (trackId)
|
|
REFERENCES Track (id) ON UPDATE CASCADE ON DELETE CASCADE
|
|
);
|
|
|
|
-- Down
|
|
DROP TABLE Playlist;
|
|
DROP TABLE Track;
|
|
DROP TABLE PlaylistEntry;
|