Fix migration to support null values
This commit is contained in:
@@ -24,16 +24,17 @@ func upUnescapeLyricsAndComments(tx *sql.Tx) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var id, comment, lyrics, title string
|
var id, title string
|
||||||
|
var comment, lyrics sql.NullString
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
err = rows.Scan(&id, &comment, &lyrics, &title)
|
err = rows.Scan(&id, &comment, &lyrics, &title)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
comment = utils.SanitizeText(comment)
|
newComment := utils.SanitizeText(comment.String)
|
||||||
lyrics = utils.SanitizeText(lyrics)
|
newLyrics := utils.SanitizeText(lyrics.String)
|
||||||
_, err = stmt.Exec(comment, lyrics, id)
|
_, err = stmt.Exec(newComment, newLyrics, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error unescaping media_file's lyrics and comments", "title", title, "id", id, err)
|
log.Error("Error unescaping media_file's lyrics and comments", "title", title, "id", id, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user