From cae5fb03b3e61aecf2bdcd85a2e7f8882e985fba Mon Sep 17 00:00:00 2001 From: RXWatcher <14085001+RXWatcher@users.noreply.github.com> Date: Tue, 26 May 2026 21:46:21 +0200 Subject: [PATCH] feat(audiobooks): migrations 154 + 155 for Phase 1 close-out 154 adds hide_from_continue to user_watch_progress (backs the ABS remove/readd-to-continue-listening endpoints). 155 creates abs_rss_feeds for the upcoming RSS surface. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...watch_progress_hide_from_continue.down.sql | 2 ++ ...r_watch_progress_hide_from_continue.up.sql | 7 ++++++ migrations/155_abs_rss_feeds.down.sql | 3 +++ migrations/155_abs_rss_feeds.up.sql | 25 +++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 migrations/154_user_watch_progress_hide_from_continue.down.sql create mode 100644 migrations/154_user_watch_progress_hide_from_continue.up.sql create mode 100644 migrations/155_abs_rss_feeds.down.sql create mode 100644 migrations/155_abs_rss_feeds.up.sql diff --git a/migrations/154_user_watch_progress_hide_from_continue.down.sql b/migrations/154_user_watch_progress_hide_from_continue.down.sql new file mode 100644 index 00000000..a8de870e --- /dev/null +++ b/migrations/154_user_watch_progress_hide_from_continue.down.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.user_watch_progress + DROP COLUMN IF EXISTS hide_from_continue; diff --git a/migrations/154_user_watch_progress_hide_from_continue.up.sql b/migrations/154_user_watch_progress_hide_from_continue.up.sql new file mode 100644 index 00000000..962a997b --- /dev/null +++ b/migrations/154_user_watch_progress_hide_from_continue.up.sql @@ -0,0 +1,7 @@ +-- Toggle for hiding an in-progress book from the Continue Listening +-- shelf without affecting the progress row itself. Used by the +-- ABS-compat /me/progress/{itemId}/remove-from-continue-listening + +-- /readd-to-continue-listening endpoints. + +ALTER TABLE public.user_watch_progress + ADD COLUMN IF NOT EXISTS hide_from_continue boolean NOT NULL DEFAULT false; diff --git a/migrations/155_abs_rss_feeds.down.sql b/migrations/155_abs_rss_feeds.down.sql new file mode 100644 index 00000000..76c5c761 --- /dev/null +++ b/migrations/155_abs_rss_feeds.down.sql @@ -0,0 +1,3 @@ +DROP INDEX IF EXISTS public.abs_rss_feeds_user_profile_idx; +DROP INDEX IF EXISTS public.abs_rss_feeds_slug_uniq; +DROP TABLE IF EXISTS public.abs_rss_feeds; diff --git a/migrations/155_abs_rss_feeds.up.sql b/migrations/155_abs_rss_feeds.up.sql new file mode 100644 index 00000000..644e7f70 --- /dev/null +++ b/migrations/155_abs_rss_feeds.up.sql @@ -0,0 +1,25 @@ +-- Audiobookshelf-style RSS podcast feeds. Each row exposes one +-- audiobook (library_item_id) as a public RSS XML feed reachable at +-- /feed/{slug}.xml — slug is the unguessable capability token. +-- closed_at is NULL while the feed is active; closing soft-deletes +-- so re-opening creates a new row with a new slug. + +CREATE TABLE IF NOT EXISTS public.abs_rss_feeds ( + id text PRIMARY KEY, + user_id integer NOT NULL REFERENCES public.users(id) ON DELETE CASCADE, + profile_id uuid, + library_item_id text NOT NULL REFERENCES public.media_items(content_id) ON DELETE CASCADE, + slug text NOT NULL, + minified boolean NOT NULL DEFAULT false, + created_at timestamptz NOT NULL DEFAULT now(), + closed_at timestamptz +); + +CREATE UNIQUE INDEX IF NOT EXISTS abs_rss_feeds_slug_uniq + ON public.abs_rss_feeds (slug); + +CREATE INDEX IF NOT EXISTS abs_rss_feeds_user_profile_idx + ON public.abs_rss_feeds ( + user_id, + COALESCE(profile_id, '00000000-0000-0000-0000-000000000000'::uuid) + );