feat: data lifecycle rewrite, download clients, wanted list, and central catalog index
Ships the fresh-start schema cleanup: rebuilt explore catalog index pipeline (dump import, artifact fetch/build, incremental listen-count refresh), a new download subsystem (Lidarr/Prowlarr/qBittorrent/SABnzbd/ slskd/yt-dlp providers, staging, reconciliation, wanted list), and the supporting schema/query/store changes across backend and frontend. Also includes two smaller follow-ups: bump the central index's rebuild-after cadence from 90 to 180 days, and remove the Explore "library only" online/offline toggle entirely (frontend-only, no backend counterpart) rather than carry unused UI/state. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2Agd9af5hE7qzti2ackiS
This commit is contained in:
@@ -2,9 +2,7 @@ package database
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"io/fs"
|
||||
"log/slog"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
_ "modernc.org/sqlite" // Register sqlite driver.
|
||||
@@ -34,31 +32,10 @@ func NewTestDB(t *testing.T) *DB {
|
||||
t.Fatalf("could not apply PRAGMAs: %v", err)
|
||||
}
|
||||
|
||||
dirEntries, err := schemas.ReadDir("sql/schemas")
|
||||
if err != nil {
|
||||
t.Fatalf("could not read schemas directory: %v", err)
|
||||
}
|
||||
|
||||
for _, dirEntry := range dirEntries {
|
||||
if !dirEntry.IsDir() {
|
||||
filePath := path.Join("sql/schemas", dirEntry.Name())
|
||||
|
||||
sqlContent, err := fs.ReadFile(schemas, filePath)
|
||||
if err != nil {
|
||||
t.Fatalf("could not read file %s: %v", filePath, err)
|
||||
}
|
||||
|
||||
if _, err = db.ExecContext(ctx, string(sqlContent)); err != nil {
|
||||
t.Fatalf(
|
||||
"error executing sql from file %s: %v",
|
||||
filePath, err,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := runMigrations(ctx, db, slog.Default(), ":memory:"); err != nil {
|
||||
t.Fatalf("could not run migrations: %v", err)
|
||||
// The same call production uses, so a test database and a real one
|
||||
// cannot diverge.
|
||||
if err := applySchema(ctx, db); err != nil {
|
||||
t.Fatalf("could not apply schema: %v", err)
|
||||
}
|
||||
|
||||
// Insert a sentinel library row at id=0 so audio_files inserts
|
||||
|
||||
Reference in New Issue
Block a user