Add constraint on the comment url

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-04-28 18:25:21 +02:00
parent 614ead1777
commit 4a1e9ce713
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -126,6 +126,7 @@ defmodule Mobilizon.Discussions.Comment do
|> put_assoc(:media, Map.get(attrs, :media, [])) |> put_assoc(:media, Map.get(attrs, :media, []))
|> put_tags(attrs) |> put_tags(attrs)
|> put_mentions(attrs) |> put_mentions(attrs)
|> unique_constraint(:url, name: :comments_url_index)
end end
@spec maybe_generate_uuid(Ecto.Changeset.t()) :: Ecto.Changeset.t() @spec maybe_generate_uuid(Ecto.Changeset.t()) :: Ecto.Changeset.t()