feat(db): fold every migration into one baseline at version 106
release / web (push) Successful in 1m13s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 3m56s
release / android (push) Successful in 4m19s
release / Build signed APK (push) Successful in 4m40s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 14s
release / Verify release artifacts (tag releases only) (push) Skipped

0106_baseline.up.sql is the schema at version 106 and the settings rows
it starts with, taken from a database migrated through 0001–0106; a
database built from the baseline alone dumps identically. A database
already at 106 skips it. Comments that pointed at a migration number now
name the table or constraint instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 00:57:18 -05:00
co-authored by Claude Opus 5.5
parent 13df3d756d
commit 285a24f0ab
247 changed files with 1480 additions and 4200 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ const acoustIDLookupConcurrency = 2
// silence; a radio edit or a live take differs by far more.
const acoustIDDurationToleranceSec = 3
// Lookup states, as migration 0069's CHECK has them.
// Lookup states, as the CHECK on track_acoustid_lookups.state has them.
const (
lookupMatched = "matched"
lookupAmbiguous = "ambiguous"
+2 -2
View File
@@ -31,10 +31,10 @@ type AcoustIDSettings struct {
// Ready reports whether the worker may call AcoustID at all.
func (s AcoustIDSettings) Ready() bool { return s.Enabled && s.APIKey != "" }
// DefaultAcoustIDSettings mirrors migration 0069's defaults: off, no key.
// DefaultAcoustIDSettings mirrors acoustid_settings's defaults: off, no key.
var DefaultAcoustIDSettings = AcoustIDSettings{MinScore: 0.85}
// The score threshold's bounds, as migration 0069's CHECK has them. Below 0.5
// The score threshold's bounds, as acoustid_settings's CHECK has them. Below 0.5
// AcoustID's own docs call a match doubtful; the floor keeps a typo in the
// field from filling the library with guesses.
const (
+4 -4
View File
@@ -20,13 +20,13 @@ import (
//
// The length is the dangerous knob: chromaprints taken at two lengths cannot be
// compared. Rather than bumping fingerprintVersion when it changes, every row
// records the length it was taken at (migration 0061) and every reader filters
// on the current one. A row at another length is stale to the backfill, pending
// records the length it was taken at (track_fingerprints.chromaprint_length_sec)
// and every reader filters on the current one. A row at another length is stale to the backfill, pending
// to the gauge and invisible to the sweep, which is the effect a version bump
// would have, with one difference worth having: setting the length back makes
// rows not yet re-derived current again, instead of redoing the library twice.
// Bounds for each setting, mirrored by migration 0061's CHECKs.
// Bounds for each setting, mirrored by fingerprint_settings's CHECKs.
const (
// Below 30s a print has too few items to align at the matcher's larger
// offsets and still overlap by minOverlapItems. Above 600s each print
@@ -65,7 +65,7 @@ type FingerprintSettings struct {
UpdatedAt time.Time
}
// DefaultFingerprintSettings mirrors migration 0061's column defaults, so a
// DefaultFingerprintSettings mirrors fingerprint_settings's column defaults, so a
// database that cannot be read still fingerprints the way a fresh install does.
var DefaultFingerprintSettings = FingerprintSettings{
Enabled: true,
@@ -84,7 +84,7 @@ func TestFingerprintSettingsService_Integration(t *testing.T) {
t.Fatalf("load: %v", err)
}
// ResetDB puts every column back to its migration default, so this pins the
// Go defaults to migration 0061's. Were they to drift, a database that
// Go defaults to fingerprint_settings's. Were they to drift, a database that
// could not be read would fingerprint differently from one that could.
loaded := svc.Get()
if loaded.UpdatedAt.IsZero() {
+4 -4
View File
@@ -29,7 +29,7 @@ type LoudnessSettings struct {
UpdatedAt time.Time
}
// DefaultLoudnessSettings mirrors migrations 0065 and 0068's column defaults,
// DefaultLoudnessSettings mirrors loudness_settings's column defaults,
// so a database that cannot be read still analyzes the way a fresh install
// does.
var DefaultLoudnessSettings = LoudnessSettings{
@@ -38,14 +38,14 @@ var DefaultLoudnessSettings = LoudnessSettings{
LeveledCacheMB: 2048,
}
// The leveled-stream cache's bounds, as migration 0068's CHECK has them.
// The leveled-stream cache's bounds, as loudness_settings's CHECK has them.
const (
minLeveledCacheMB = 256
maxLeveledCacheMB = 65536
)
// ErrLoudnessSettingOutOfRange is returned by Set for a value migration 0065's
// CHECK would reject, so the API answers 400 naming the field.
// ErrLoudnessSettingOutOfRange is returned by Set for a value loudness_settings's
// CHECKs would reject, so the API answers 400 naming the field.
var ErrLoudnessSettingOutOfRange = errors.New("loudness setting out of range")
// LoudnessSettingsService caches the settings and owns their persistence.
+2 -2
View File
@@ -26,7 +26,7 @@ type NormalizationPrefs struct {
Boost string `json:"boost"`
}
// The accepted values. Migration 0067's CHECKs hold the same lists.
// The accepted values. user_normalization_prefs's CHECKs hold the same lists.
var (
NormalizationModes = []string{"off", "auto", "track", "album"}
NormalizationTargets = []int16{-18, -16, -14}
@@ -34,7 +34,7 @@ var (
)
// DefaultNormalizationPrefs applies to a user who has never chosen. It must
// equal migration 0067's column defaults; a test holds them together.
// equal user_normalization_prefs's column defaults; a test holds them together.
var DefaultNormalizationPrefs = NormalizationPrefs{Mode: "auto", TargetLUFS: -18, Boost: "headroom"}
// ErrNormalizationPrefsInvalid is returned for a value outside the lists.
+1 -1
View File
@@ -42,7 +42,7 @@ var audioExtensions = map[string]bool{
// tagReadVersion is the version of this package's tag-extraction logic. Rows
// whose tracks.tag_read_version is lower get their tags re-read on the next
// scan even when the file itself hasn't changed, so a fix reaches an existing
// library without anyone rebuilding it (migration 0054).
// library without anyone rebuilding it.
//
// Bump this whenever a change to tag extraction should reach already-indexed
// files, and say why below.