Hi,
I’m having a similar issue with mysql and uuid, but can’t find a solution.
Creating and reading an entry works in about 80% of the time, but in the other cases the id in the database will be different than the one in the changeset.
i wrote a simple test that inserts and then reads again like this:
def failtest(conn, _params) do
insert(conn, 0) |> index(nil)
end
def insert(conn, count)do
changeset = Picture.changeset(%Picture{}, %{name: "test"<>Integer.to_string(count)})
Repo.insert(changeset)
|> case do
{:ok, picture} ->
cond do
Repo.one(from p in Picture, where: p.id == ^picture.id) ->
if count < 100 do
insert(conn, count+1)
else
conn |> put_flash(:info, "finished")
end
true ->
conn |> put_flash(:error, "couldn't find entry")
end
{:error, _param} ->
conn |> put_flash(:error, "couldn't insert")
end
end
Usually it will abort somewhere between 2 and 15 entries created.
Does someone have an idea about that?