Have your tried:
source = %MyModule{} |> Repo.insert!()
new = Repo.get!(MyModule, source.id)
new2 = Repo.get!(MyModule, new.id)
assert new2.id == new.id
What is not clear is whether new
actually originates from the same record that was created by the previous Repo.insert!
. If there are other records in the table, new
could be an entirely different record.
Some experiments with iEX and the SQL shell could shed some light on that:
- after the insert - is there a record with the new UUID (e.g.
3f3fd9a2-3f69-463e-3f3f-153f34003f3f
) - after the retrieve - is there a record with the different UUID (e.g.
85c9d9a2-a969-463e-a8d5-15f834009ebc
) - does the remainder of the retrieved record match the former or the latter record content?
This was never resolved: