cloak_ecto
cloak_ecto copied to clipboard
Migrator breaks with Ecto.Enum field in the same schema
I have a schema with one encrypted field and want to rotate the keys, but the schema also has a field :state, Ecto.Enum, values: [:enabled, :disabled, :archived], default: :enabled
field and it is raising an exception:
** (FunctionClauseError) no function clause matching in Code.ensure_loaded?/1
The following arguments were given to Code.ensure_loaded?/1:
# 1
{:parameterized, Ecto.Enum, %{embed_as: :self, mappings: [enabled: "enabled", disabled: "disabled", archived: "archived"], on_cast: %{"archived" => :archived, "disabled" => :disabled, "enabled" => :enabled}, on_dump: %{archived: "archived", disabled: "disabled", enabled: "enabled"}, on_load: %{"archived" => :archived, "disabled" => :disabled, "enabled" => :enabled}, type: :string}}
Attempted function clauses (showing 1 out of 1):
def ensure_loaded?(module) when is_atom(module)
(elixir 1.13.4) lib/code.ex:1472: Code.ensure_loaded?/1
(cloak_ecto 1.2.0) lib/cloak_ecto/migrator.ex:77: Cloak.Ecto.Migrator.cloak_field?/1
(elixir 1.13.4) lib/enum.ex:4034: Enum.filter_list/2
(cloak_ecto 1.2.0) lib/cloak_ecto/migrator.ex:62: Cloak.Ecto.Migrator.cloak_fields/1
I assume a fix would have to be pushed so I'll try looking into it, but if anyone has any ideas in the meantime, it'd be appreciated.