sorry, was to fast and there was a bug in the documentation, I guess I meant use upsert options for insert (doc bug fixed here Repo: Reference correct function in insert/2 upsert docs (#1909) · elixir-ecto/ecto@acf8016 · GitHub)
{:ok, %Trackware.Schools.Parent{ id: father_id }} = SRepo.insert(father_head , on_conflict: :replace_all, conflict_target: :mobile_number)
should be able to replace the entire code snippet you posted.
I would guess this would still be needed in a multi, as you might have student siblings that gives you these conflicts.






















