-- 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;