feat: add personal playlists and shareable track links
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a097c15c8
commit
fa79394869
46 files changed
+2307
-292
No files matched your search
@@ -0,0 +1,23 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE playlists (
|
||||
id uuid PRIMARY KEY,
|
||||
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
name text NOT NULL CHECK (char_length(name) BETWEEN 1 AND 120),
|
||||
description text NOT NULL DEFAULT '' CHECK (char_length(description) <= 2000),
|
||||
revision integer NOT NULL DEFAULT 1,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE INDEX playlists_owner ON playlists(user_id, updated_at DESC, id);
|
||||
CREATE TABLE playlist_tracks (
|
||||
playlist_id uuid NOT NULL REFERENCES playlists(id) ON DELETE CASCADE,
|
||||
track_id uuid NOT NULL REFERENCES tracks(id) ON DELETE CASCADE,
|
||||
position integer NOT NULL CHECK (position >= 0),
|
||||
PRIMARY KEY (playlist_id, track_id),
|
||||
UNIQUE (playlist_id, position)
|
||||
);
|
||||
CREATE INDEX playlist_tracks_track ON playlist_tracks(track_id);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE playlist_tracks;
|
||||
DROP TABLE playlists;
|
||||
Reference in new issue
Block a user