Ensure uniqueness of scrobble rules

This commit is contained in:
Claudio Ortolina
2026-02-02 10:32:32 +00:00
parent 76f6791a45
commit faf8500256
3 changed files with 20 additions and 0 deletions
@@ -29,5 +29,6 @@ defmodule MusicLibrary.ScrobbleRules.ScrobbleRule do
scrobble_rule
|> cast(attrs, [:type, :match_value, :target_musicbrainz_id, :enabled, :description])
|> validate_required([:type, :match_value, :target_musicbrainz_id])
|> unique_constraint([:type, :match_value], error_key: :match_value)
end
end