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
-40
View File
@@ -39,7 +39,6 @@ const TestUserPrefix = "test-"
var dataTables = []string{
"artist_similarity",
"track_similarity",
"artist_similarity_unmatched",
"listenbrainz_similar_recordings",
"track_similarity_fetches",
"artist_similarity_fetches",
@@ -59,13 +58,10 @@ var dataTables = []string{
// does NOT reach it for a leftover row whose user survived. Truncate
// explicitly or a stale snooze silently hides a candidate from the
// next test's suggestion assertions.
"suggestion_snoozes",
// Same reasoning: keyed by candidate MBID with no FK anywhere,
// so nothing cascades to them. A leftover tag row would make a
// candidate look enriched to the next test, and a leftover state row
// would make it look already-settled and thus ineligible.
"candidate_artist_tags",
"candidate_artist_tag_state",
"playlist_tracks",
"playlists",
"library_changes", // reset so each test's sync cursor starts clean
@@ -87,7 +83,6 @@ var dataTables = []string{
// Same reasoning as taste_tuning above: recsettings.New re-seeds
// shipped defaults on every construction, so truncating gives each test
// pristine Discover knobs rather than whatever a previous test tuned.
"discover_tuning",
"recommendation_tuning_audit",
"duplicate_group_members",
"duplicate_groups",
@@ -101,21 +96,9 @@ var dataTables = []string{
"user_notifications",
"user_notification_prefs",
"user_notification_email_state",
"acquisition_services",
"mb_release_tracks",
"mb_releases",
"mb_artist_release_groups",
"mb_release_groups",
"mb_artists",
"requests",
"download_interventions",
"library_album_matches",
"release_blocks",
"grabs",
"want_candidates",
"wants",
"follow_seen_groups",
"follows",
"tracks",
"albums",
"artists",
@@ -173,17 +156,6 @@ func ResetDB(t *testing.T, pool *pgxpool.Pool) {
); err != nil {
t.Fatalf("dbtest.ResetDB reset loudness settings: %v", err)
}
// Release-type profiles: migration 0081 seeds "Standard" as
// the default. Tests add and edit profiles, so put back exactly the
// seeded row rather than truncating it away.
if _, err := pool.Exec(ctx, `
DELETE FROM release_type_profiles WHERE name <> 'Standard';
UPDATE release_type_profiles
SET primary_types = ARRAY['Album', 'EP', 'Single'], secondary_types = '{}', is_default = true
WHERE name = 'Standard'`,
); err != nil {
t.Fatalf("dbtest.ResetDB reset release-type profiles: %v", err)
}
// The change log's trimmed mark, a singleton: nothing has been trimmed.
if _, err := pool.Exec(ctx, "UPDATE library_changes_trimmed SET through = 0"); err != nil {
t.Fatalf("dbtest.ResetDB reset library_changes_trimmed: %v", err)
@@ -199,18 +171,6 @@ func ResetDB(t *testing.T, pool *pgxpool.Pool) {
); err != nil {
t.Fatalf("dbtest.ResetDB reset backup settings: %v", err)
}
// Search and grab settings, a singleton reset the same way.
// The library listing reads as done, so a test's albums are not
// put on the wanted list behind its back; its own tests clear it.
if _, err := pool.Exec(ctx, `
UPDATE acquisition_settings
SET auto_grab = DEFAULT, search_interval_hours = DEFAULT, allowed_qualities = DEFAULT, import_root = DEFAULT,
seed_ratio = DEFAULT, seed_days = DEFAULT, stall_hours = DEFAULT, upgrade_until = DEFAULT,
library_listing_started_at = now(), library_listed_at = now(), library_unlisted = 0,
last_pass_at = NULL, last_pass = DEFAULT, updated_at = DEFAULT`,
); err != nil {
t.Fatalf("dbtest.ResetDB reset acquisition settings: %v", err)
}
// Notification email settings, reset the same way.
if _, err := pool.Exec(ctx, `
UPDATE notification_email_settings