Prevent importing the same record twice

This commit is contained in:
Claudio Ortolina
2024-11-05 11:40:01 +00:00
parent 5674937ab0
commit 74a11ca10f
4 changed files with 18 additions and 3 deletions
+1
View File
@@ -48,6 +48,7 @@ defmodule MusicLibrary.Records.Record do
|> cast_embed(:artists, with: &artist_changeset/2)
|> generate_cover_hash()
|> validate_required([:type, :title, :musicbrainz_id, :release, :genres])
|> unique_constraint(:musicbrainz_id, name: "records_musicbrainz_id_format_index")
end
@doc false