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
@@ -3,7 +3,7 @@ defmodule MusicLibrary.Repo.Migrations.CreateScrobbledTracks do
def change do
create table(:scrobbled_tracks, primary_key: false) do
add :scrobbled_at_uts, :integer, primary_key: true
add :scrobbled_at_uts, :integer
add :musicbrainz_id, :string
add :title, :string
add :cover_url, :string
@@ -12,5 +12,7 @@ defmodule MusicLibrary.Repo.Migrations.CreateScrobbledTracks do
add :album, :map
add :last_fm_data, :map
end
create index(:scrobbled_tracks, [:scrobbled_at_uts, :title], unique: true)
end
end