Fix scrobble tracks schema

Remove the primary key, and just set a unique index on scrobbled time
and title, which allows skipping duplicates.
This commit is contained in:
Claudio Ortolina
2025-05-31 20:54:37 +01:00
parent 54ee77995a
commit b191d87dfd
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -20,7 +20,8 @@ defmodule LastFm.Import do
# HACK: if two tracks happen to have the exact same scrobbled_at_uts,
# we move it by a sec.
MusicLibrary.Repo.insert_all(LastFm.Track, track_params,
on_conflict: [inc: [scrobbled_at_uts: -1]]
on_conflict: :nothing,
conflict_target: [:scrobbled_at_uts, :title]
)
end
end