fix: use sql.NullTime for last_played to handle NULL scan

COALESCE(last_played, '') returned empty string which can't scan into
time.Time. Removed COALESCE, use sql.NullTime instead. Format to string
only when Valid.
This commit is contained in:
2026-03-21 15:40:34 -04:00
parent b643aee5a3
commit 2db6e09aa3
3 changed files with 33 additions and 21 deletions
+2 -2
View File
@@ -97,7 +97,7 @@ SELECT
af.bitrate,
af.file_size,
af.play_count,
COALESCE(af.last_played, '') AS last_played
af.last_played
FROM audio_files af
JOIN recordings r ON af.recording_id = r.id
JOIN artist_credit ac ON r.artist_credit_id = ac.id
@@ -163,7 +163,7 @@ SELECT
af.bitrate,
af.file_size,
af.play_count,
COALESCE(af.last_played, '') AS last_played
af.last_played
FROM audio_files af
JOIN recordings r ON af.recording_id = r.id
JOIN artist_credit ac ON r.artist_credit_id = ac.id