release / govulncheck (push) Successful in 17s
release / web (push) Successful in 1m33s
release / go (push) Successful in 1m49s
release / integration (push) Successful in 5m42s
release / android (push) Successful in 5m59s
release / Build signed APK (releases and dev) (push) Successful in 6m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
Applies rule 32's migration exception: each header still says what the schema was, what changes and what it prevents, but task, milestone, decision and rule ids are replaced by the practice they stood for, the operator quotes by the decision, single-install counts are dropped, and pointers to a deleted package and an external design doc are gone. golang-migrate keeps no checksum, so editing applied migrations' comments is safe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.6 KiB
SQL
37 lines
1.6 KiB
SQL
-- 0034_you_might_like.up.sql — "You might like" Home rows.
|
|
--
|
|
-- Per-user ranked lists of IN-LIBRARY albums/artists the listener
|
|
-- doesn't actively spin but is predicted to enjoy, derived from the
|
|
-- same similarity + like-weighted candidate engine that powers For-You
|
|
-- (rolled up from track scores to album/artist). Built in the daily
|
|
-- 3am BuildSystemPlaylists pass and atomic-replaced, exactly like the
|
|
-- system playlists; read back by /api/home.
|
|
--
|
|
-- Two thin tables (id + rank) rather than denormalized snapshots: the
|
|
-- Home read path hydrates album/artist refs through the existing
|
|
-- albums/artists joins, so a later metadata edit is reflected without
|
|
-- a rebuild. CASCADE on user/album/artist deletes keeps them clean.
|
|
|
|
CREATE TABLE you_might_like_albums (
|
|
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
album_id uuid NOT NULL REFERENCES albums(id) ON DELETE CASCADE,
|
|
rank integer NOT NULL,
|
|
built_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (user_id, album_id)
|
|
);
|
|
|
|
-- Read path orders by rank within a user; the index serves it directly.
|
|
CREATE INDEX you_might_like_albums_user_rank_idx
|
|
ON you_might_like_albums (user_id, rank);
|
|
|
|
CREATE TABLE you_might_like_artists (
|
|
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
artist_id uuid NOT NULL REFERENCES artists(id) ON DELETE CASCADE,
|
|
rank integer NOT NULL,
|
|
built_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (user_id, artist_id)
|
|
);
|
|
|
|
CREATE INDEX you_might_like_artists_user_rank_idx
|
|
ON you_might_like_artists (user_id, rank);
|