SamTV12345-PodFetch/migrations/postgres/2023-07-23-083222_playlist/up.sql

16 lines
417 B
SQL

-- Your SQL goes here
CREATE TABLE playlists (
id TEXT NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
user_id INTEGER NOT NULL
);
CREATE TABLE playlist_items (
playlist_id TEXT NOT NULL,
episode INTEGER NOT NULL,
position INTEGER NOT NULL,
FOREIGN KEY (playlist_id) REFERENCES playlists(id),
FOREIGN KEY (episode) REFERENCES podcast_episodes(id),
PRIMARY KEY (playlist_id, episode)
);