I recently updated Ecto along with some other packages and noticed some function changes. They added Repo.transact\2
, so I could remove my helper function which I found on these forums a while back. Nice
But some other code was now showing warnings - anything starting with Ecto.Multi.new
Here’s the shortened warning:
The call 'Elixir.Ecto.Multi':update
(#{'__struct__' := 'Elixir.Ecto.Multi',
'names' := #{'__struct__' := 'Elixir.MapSet', 'map' := #{}},
'operations' := []},
'user',
_changeset@1 ::
...,
'validations' := [{atom(), _}]}) does not have a term of type
#{'__struct__' := 'Elixir.Ecto.Multi',
'names' :=
#{'__struct__' := 'Elixir.MapSet',
'map' := 'Elixir.MapSet':internal(_)},
'operations' := [{_, {_, _} | {_, _, _} | {_, _, _, _}}]} (with opaque subterms) as 1st argument
Here’s the code:
Ecto.Multi.new()
|> Ecto.Multi.update(:user, changeset)
|> Ecto.Multi.delete_all(:tokens, UserToken.user_and_contexts_query(user, :all))
|> Repo.transact()
|> case do
{:ok, %{user: user}} -> {:ok, user}
{:error, :user, changeset, _} -> {:error, changeset}
end
It pops up in 6 other places, also with complaints about insert_all
.
So I’m sure the problem is with Multi.new
but the changelog never mentions it.
Any idea what is going on here?