diff --git a/lib/outlook/articles/article.ex b/lib/outlook/articles/article.ex index 8477089..2dfc7ce 100644 --- a/lib/outlook/articles/article.ex +++ b/lib/outlook/articles/article.ex @@ -23,5 +23,6 @@ defmodule Outlook.Articles.Article do article |> cast(attrs, [:title, :content, :url, :language, :date, :author_id]) |> validate_required([:title, :content, :url, :language, :date, :author_id]) + |> foreign_key_constraint(:author_id) end end diff --git a/lib/outlook/translations/translation.ex b/lib/outlook/translations/translation.ex index 3bac399..ba4b59a 100644 --- a/lib/outlook/translations/translation.ex +++ b/lib/outlook/translations/translation.ex @@ -29,5 +29,6 @@ defmodule Outlook.Translations.Translation do |> unique_constraint([:lang, :article_id], message: "translation for this language already exists", name: :article_id_lang_unique_index) + |> foreign_key_constraint(:article_id) end end