-- Upgrades (M502 #5524): a held album whose copy is below the quality the -- operator settles for, or that holds a video rip, stays wanted for a better -- copy. The import replaces the old tracks with the new ones. -- -- acquisition_settings.upgrade_until the tier a held album is upgraded to; -- '' switches quality upgrades off. -- Lidarr's "Any" profile upgraded up to -- High Quality Lossy (note #5527). -- wants.upgrade why a held album is wanted again: -- quality (below upgrade_until) or rip -- (a track is a video rip); '' not. -- wants.held_tier, held_quality the library copy's tier, estimated -- from format and size per second, and -- the same in words. -- wants.upgrade_checked_at when the wanted worker last judged it. -- want_candidates.verdict unchanged: a release no better than -- the copy held is "refused". ALTER TABLE acquisition_settings ADD COLUMN upgrade_until text NOT NULL DEFAULT 'lossy_high'; ALTER TABLE wants ADD COLUMN upgrade text NOT NULL DEFAULT '' CONSTRAINT wants_upgrade_check CHECK (upgrade IN ('', 'quality', 'rip')), ADD COLUMN held_tier text NOT NULL DEFAULT '', ADD COLUMN held_quality text NOT NULL DEFAULT '', ADD COLUMN upgrade_checked_at timestamptz; CREATE INDEX wants_upgrade_idx ON wants (searched_at NULLS FIRST) WHERE fulfilled_at IS NOT NULL AND upgrade <> '';