Skip to content

Commit

Permalink
Merge pull request #51 from danielberkompas/46-ecto-enum
Browse files Browse the repository at this point in the history
🐛 Fix `Migrator` when schema contains `Ecto.Enum`
  • Loading branch information
danielberkompas authored Apr 6, 2024
2 parents 62e6dff + 500034e commit be99311
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cloak_ecto/migrator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ defmodule Cloak.Ecto.Migrator do
false
end

defp cloak_field?({_field, {:parameterized, Ecto.Enum, _opts}}) do
false
end

defp cloak_field?({field, {kind, inner_type}}) when kind in [:array, :map] do
cloak_field?({field, inner_type})
end
Expand Down
1 change: 1 addition & 0 deletions test/support/migrations/20180321184642_create_users.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defmodule Cloak.Ecto.TestRepo.Migrations.CreateUsers do
add(:name, :string)
add(:email, :binary)
add(:email_hash, :binary)
add(:status, :string)

timestamps(type: :utc_datetime)
end
Expand Down
2 changes: 2 additions & 0 deletions test/support/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ defmodule Cloak.Ecto.TestUser do
field(:name, :string)
field(:email, Cloak.Ecto.Encrypted.Binary)
field(:email_hash, Cloak.Ecto.Hashed.HMAC)
field(:status, Ecto.Enum, values: [active: "active", disabled: "disabled"])

timestamps(type: :utc_datetime)
end
end

0 comments on commit be99311

Please sign in to comment.