fix: raise if primary_key: true and no prefix (#22)

This commit is contained in:
Sloane 2023-07-16 11:36:19 -04:00 committed by GitHub
parent c9eb03b44e
commit dd8f957106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -1,7 +1,7 @@
defmodule TypeID.MixProject do
use Mix.Project
@version "0.5.0"
@version "0.5.1"
def project do
[