feat(db): drop the acquisition and Discover tables
release / web (push) Successful in 1m22s
release / go (push) Successful in 1m49s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m10s
release / android (push) Successful in 4m27s
release / Build signed APK (push) Successful in 4m56s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped

Migration 105 removes the tables the acquisition and Discover features
kept, and users.auto_approve_requests. Before library_album_matches goes,
an album with no release-group MBID takes the one its match listed.
Tables drop without CASCADE, in reference order, so a reference from a
table that stays stops the migration. The down migration refuses: the
data is gone, and a backup from before it is the way back.

The backup table list, the test reset list and the duplicate and user
queries follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 00:20:22 -05:00
co-authored by Claude Opus 5.5
parent 741c748135
commit 8c6bbac48d
13 changed files with 84 additions and 387 deletions
@@ -0,0 +1,44 @@
-- Minstrel plays and keeps the library it is given; it no longer finds
-- music. This drops the tables that served finding it (follows, wants,
-- searches, downloads, requests and their settings), the Discover tables,
-- the MusicBrainz artist catalogue only those used, and the per-user
-- auto-approve switch.
--
-- An album matched to a release group only through its wanted-listing
-- match keeps that release group: it is copied onto the album first, where
-- the duplicate resolver reads it.
UPDATE albums al
SET release_group_mbid = lam.release_group_mbid
FROM library_album_matches lam
WHERE lam.album_id = al.id
AND lam.outcome = 'listed'
AND COALESCE(lam.release_group_mbid, '') <> ''
AND COALESCE(al.release_group_mbid, '') = '';
-- Each table goes after the tables that reference it, without CASCADE, so
-- a reference from a table that stays stops the migration instead of being
-- dropped quietly.
DROP TABLE download_interventions;
DROP TABLE want_candidates;
DROP TABLE release_blocks;
DROP TABLE grabs;
DROP TABLE wants;
DROP TABLE follow_seen_groups;
DROP TABLE follows;
DROP TABLE release_type_profiles;
DROP TABLE requests;
DROP TABLE acquisition_services;
DROP TABLE acquisition_settings;
DROP TABLE reacquisition_settings;
DROP TABLE library_album_matches;
DROP TABLE suggestion_snoozes;
DROP TABLE discover_tuning;
DROP TABLE candidate_artist_tag_state;
DROP TABLE candidate_artist_tags;
DROP TABLE artist_similarity_unmatched;
DROP TABLE mb_artist_release_groups;
DROP TABLE mb_artists;
ALTER TABLE users DROP COLUMN auto_approve_requests;