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:
Deluan 2026-06-19 15:33:17 -04:00
commit 65790430b3

View file

@ -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 {