Hey all! I just started using Ecto.Multi, and I’ve run into a snag that I was hoping someone could help me with.
Here’s what my transaction looks like:
Multi.new() |> Multi.run(:multi_one, fn _ -> create_new_records(user_id) end) |> Multi.run(:multi_two, fn _ -> get_all_records(user_id) end) |> Repo.transaction()
To give some context, the first Multi run statement creates records in the database within a nested transaction. The second Multi run statement then queries that user’s records which SHOULD include the new ones I just created. However, the newly created records are not coming back in that select.
Does anyone know what could be up? Am I just making incorrect assumptions that those inserts would be immediately available in the next stage of my Multi transaction?
Thanks so much!