navidrome/db
Deluan 5377c2b2b3 fix(scanner): repair NOT NULL bpm/bit_depth columns left by out-of-order migration
On some databases, migration 20260612222838 (which made media_file.bpm and
bit_depth nullable) is recorded as applied in goose_db_version but its DDL
never took effect, leaving the columns declared NOT NULL. Since v0.63.0 the
scanner writes NULL for tracks without a BPM tag (PR #5603 changed the model
fields to *int and removed the nil->0 shim), so scans on those databases fail
with "NOT NULL constraint failed: media_file.bpm". Because goose considers
the earlier migration already applied, it will never re-run it, so a new
migration is required.

This migration inspects the columns via PRAGMA table_info and only rebuilds
the ones still declared NOT NULL, converting existing 0 values to NULL and
preserving the media_file_bpm index. On healthy databases it is a no-op,
avoiding a full media_file table rewrite.

Fixes #5747
2026-07-09 12:56:54 -04:00
..
migrations fix(scanner): repair NOT NULL bpm/bit_depth columns left by out-of-order migration 2026-07-09 12:56:54 -04:00
backup.go refactor(conf): replace eager dir creation with lazy Dir type (#5495) 2026-05-13 17:44:22 -03:00
backup_test.go refactor(conf): replace eager dir creation with lazy Dir type (#5495) 2026-05-13 17:44:22 -03:00
db.go fix(server): make DB PRAGMA optimize error non-fatal 2026-06-09 19:29:58 -04:00
db_test.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
export_test.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00