You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defprepare_delete(category)docategory|>change|>no_assoc_constraint(:topics)end# Without using ExAudit.RepoCategory|>Repo.get(id)|>Category.prepare_delete|>Repo.delete# {:error,# #Ecto.Changeset<action: :delete, changes: %{},# errors: [topics: {"are still associated with this entry", []}],# data: #Category<>, valid?: false>}# Using ExAudit.RepoCategory|>Repo.get(id)|>Category.prepare_delete|>Repo.delete# {:error, :rollback}
I realize this is not a straightforward (or even possible) thing to fix, but it should be very well documented that database errors and constraint messages are lost. I have a few places where there are multiple database-enforced constraints, and when using the provided Repo module, I have no way of knowing which constraint failed
The text was updated successfully, but these errors were encountered:
Seems like Repo.transaction will return {:error, :rollback} all the time, I thought returning the original return value of the wrapped repo function would suffice. I'm looking into alternatives, since I really want everything to work like before.
Wrapping all calls to insert, update, etc causes valuable information to be lost about normal database transactions.
With a schema that uses Changeset.foreign_key_constraint/3 or Changeset.no_assoc_constraint, the messages are lost.
I realize this is not a straightforward (or even possible) thing to fix, but it should be very well documented that database errors and constraint messages are lost. I have a few places where there are multiple database-enforced constraints, and when using the provided Repo module, I have no way of knowing which constraint failed
The text was updated successfully, but these errors were encountered: