mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-13 12:57:10 +02: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:
parent
39dfc54e28
commit
65790430b3
1 changed files with 4 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue