Created Playlist

This commit is contained in:
2024-04-13 15:12:50 -04:00
parent 1a9addefa4
commit 5dd0710eb8
4 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE playlists;

View File

@ -0,0 +1,12 @@
-- Your SQL goes here
CREATE TABLE playlists (
id SERIAL PRIMARY KEY UNIQUE NOT NULL,
name VARCHAR NOT NULL,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL
);
CREATE TABLE playlist_songs (
playlist_id INTEGER REFERENCES playlists(id) ON DELETE CASCADE NOT NULL,
song_id INTEGER REFERENCES songs(id) ON DELETE CASCADE NOT NULL,
PRIMARY KEY (playlist_id, song_id)
);