diff --git a/CHANGELOG.md b/CHANGELOG.md index 824beba..03bbd7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.5.1 + +- raises if `prefix` is not given when `primary_key: true` + ## 0.5.0 - `Ecto.ParameterizedType` implementation traverses associations so prefixes only need to be defined on schema primary keys diff --git a/lib/type_id/ecto.ex b/lib/type_id/ecto.ex index a32f18f..7787395 100644 --- a/lib/type_id/ecto.ex +++ b/lib/type_id/ecto.ex @@ -86,7 +86,7 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do field = Keyword.fetch!(opts, :field) default_type = Application.get_env(:typeid_elixir, :default_type, :string) type = Keyword.get(opts, :type, default_type) - prefix = Keyword.get(opts, :prefix, "") + prefix = Keyword.get(opts, :prefix) if primary_key do unless prefix && prefix =~ ~r/^[a-z]{0,63}$/ do diff --git a/mix.exs b/mix.exs index ffad24c..8206100 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule TypeID.MixProject do use Mix.Project - @version "0.5.0" + @version "0.5.1" def project do [