Is it possible to update a database field to NULL using Ecto.Repo
? Basically, is it possible to do the following:
changeset
|> put_change(:middle_name, nil)
|> Repo.update()
Right now, the change to :middle_name
is ignored because it is set to nil and Repo.update
assumes there is no change to send to the database. However, I don’t want it to be ignored. I’ve read through the documentation, browsed this forum, and have done Google searches, but nothing pops up. Am I missing something here?
The best I could find is this post which makes reference to an allow_nil
option on the schema. However, that option isn’t listed in the documentation and I couldn’t find it in the Github repo either.
I feel like I’m missing something here.