mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-19 15:23:36 +00:00
fix(lyrics): preserve [] (not null) for empty lyrics in backfill migration
ParseLyrics returns nil for zero-line input (whitespace-only stored
lyrics). json.Marshal(nil LyricList) produces null, violating the DB
invariant that media_file.lyrics uses [] for empty lyrics, never null.
Initialize to model.LyricList{} when ParseLyrics returns nil so the
marshalled result is always [].
This commit is contained in:
1 parent
39dfc54e28
commit
65790430b3
1 file changed
+4
@@ -50,6 +50,10 @@ func upAlterLyricColumn(ctx context.Context, tx *sql.Tx) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if parsed == nil {
|
||||
// Preserve the column invariant: empty lyrics serialize to [], never null
|
||||
parsed = model.LyricList{}
|
||||
}
|
||||
|
||||
text, err := json.Marshal(parsed)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user