Today I Learned

hashrocket A Hashrocket project

Handling Insertion Conflicts With Ecto Repo

When inserting an struct with Ecto.Repo, you can use the on_conflict option to handle the case of a constraint conflict. The options you can provide include :nothing, :replace_all, {:replace_all_except, fields}, and {:replace, fields}

See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.