Migrations 151 + 152 back the upcoming ABS playlist endpoints. Schema rationale documented in docs/superpowers/specs/2026-05-26-abs-collections-playlists-design.md §5.3, §5.4, §5.5. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
18 lines
769 B
SQL
18 lines
769 B
SQL
-- Items inside a playlist. library_item_id is NOT FK'd (decoupled to
|
|
-- allow future episode support); episode_id defaults to '' (empty) so
|
|
-- the unique constraint works without COALESCE.
|
|
--
|
|
-- position is a sort hint; gaps are allowed (no compaction on remove).
|
|
|
|
CREATE TABLE IF NOT EXISTS public.abs_playlist_items (
|
|
playlist_id text NOT NULL REFERENCES public.abs_playlists(id) ON DELETE CASCADE,
|
|
library_item_id text NOT NULL,
|
|
episode_id text NOT NULL DEFAULT '',
|
|
position integer NOT NULL,
|
|
added_at timestamptz NOT NULL DEFAULT now(),
|
|
UNIQUE (playlist_id, library_item_id, episode_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS abs_playlist_items_playlist_position_idx
|
|
ON public.abs_playlist_items (playlist_id, position);
|