Ego*_*kov 7 postgresql erlang elixir ecto phoenix-framework
有时我(Ecto.StaleEntryError) attempted to update a stale struct在尝试更新记录时会得到.我没有在Ecto的文档中找到任何避免这种情况的方法,那么我该怎么做才能避免这种情况呢?
PS我通过Postgrex,Ecto 2.1.3使用PostgreSQL 9.6.
Ste*_*len 11
您似乎从数据库中获取架构,并在应用程序中的其他位置更新后再更新架构.你是在抓取它,挂在它上面,还是以后更新?如果是,则获取,更改和更新.
从Ecto文档开始:
When a conflict happens (a record which has been previously fetched is
being updated, but that same record has been modified since it was
fetched), an `Ecto.StaleEntryError` exception is raised.
Run Code Online (Sandbox Code Playgroud)