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>
57 lines
3.2 KiB
SQL
57 lines
3.2 KiB
SQL
-- 0075_duplicate_resolve.up.sql — duplicates resolve themselves.
|
|
--
|
|
-- Before: the sweep (0059) proposed groups and every proposal waited for an
|
|
-- admin. After: the resolver classifies each pending group and acts on the
|
|
-- classes that are safe. What makes deletion safe is Lidarr's view of the file:
|
|
-- Lidarr maps one file to each track of the release it monitors, so deleting a
|
|
-- mapped file opens a hole it fills by downloading again. Only a copy Lidarr
|
|
-- does not map may go.
|
|
|
|
-- What kind of duplicate a group is. NULL until the resolver has classified it.
|
|
-- same_release every copy is on one album
|
|
-- cross_release the same song on different releases (a single and its album)
|
|
-- mismatch identical audio under different titles on different albums:
|
|
-- a file imported as the wrong song
|
|
-- review anything else: an admin decides
|
|
-- A new value swaps this constraint in the same migration.
|
|
ALTER TABLE duplicate_groups ADD COLUMN class text;
|
|
ALTER TABLE duplicate_groups ADD CONSTRAINT duplicate_groups_class_check
|
|
CHECK (class IN ('same_release', 'cross_release', 'mismatch', 'review'));
|
|
|
|
-- Why the resolver left a group for an admin, in words the report shows
|
|
-- ("Lidarr tracks every copy as its own track"). NULL when it had nothing to
|
|
-- say.
|
|
ALTER TABLE duplicate_groups ADD COLUMN resolve_note text;
|
|
|
|
-- True when the resolver merged the group itself, so the report can tell its
|
|
-- merges from an admin's.
|
|
ALTER TABLE duplicate_groups ADD COLUMN resolved_automatically boolean NOT NULL DEFAULT false;
|
|
|
|
-- Lidarr's view of each copy, as of the resolver's last pass:
|
|
-- tracked Lidarr holds the file and it is not among its unmapped files
|
|
-- unmapped Lidarr holds the file but maps it to no track: removing it opens
|
|
-- no hole
|
|
-- NULL when Lidarr was not consulted (disabled, or unreachable that pass).
|
|
ALTER TABLE duplicate_group_members ADD COLUMN lidarr_state text;
|
|
ALTER TABLE duplicate_group_members ADD CONSTRAINT duplicate_group_members_lidarr_state_check
|
|
CHECK (lidarr_state IN ('tracked', 'unmapped'));
|
|
|
|
-- An admin can turn the resolver off. On by default: duplicates are meant to
|
|
-- resolve themselves.
|
|
ALTER TABLE fingerprint_settings ADD COLUMN auto_resolve boolean NOT NULL DEFAULT true;
|
|
|
|
-- The resolver tells admins what it did (the kind CHECKs of 0073 are swapped
|
|
-- to carry the new value). Postgres named both from their columns.
|
|
ALTER TABLE user_notifications DROP CONSTRAINT user_notifications_kind_check;
|
|
ALTER TABLE user_notifications ADD CONSTRAINT user_notifications_kind_check
|
|
CHECK (kind IN ('request_approved', 'request_rejected', 'request_completed',
|
|
'request_pending', 'quarantine_flagged', 'scan_failed',
|
|
'tracks_missing', 'duplicates_found', 'duplicates_resolved',
|
|
'playback_errors'));
|
|
ALTER TABLE user_notification_prefs DROP CONSTRAINT user_notification_prefs_kind_check;
|
|
ALTER TABLE user_notification_prefs ADD CONSTRAINT user_notification_prefs_kind_check
|
|
CHECK (kind IN ('request_approved', 'request_rejected', 'request_completed',
|
|
'request_pending', 'quarantine_flagged', 'scan_failed',
|
|
'tracks_missing', 'duplicates_found', 'duplicates_resolved',
|
|
'playback_errors'));
|