For a given Ecto transaction, how to improve it to automatically add SQL inserts to log all changed values from executed changesets ? Here are unsuccessful tries:
Using Ecto.Multi:
Ecto.Multi.to_list is not a solution since the multi can contain Ecto.Multi.run operations (these operations are needed in case of dependencies between operations: for example when creating an account with its first user, we need to inject the account id in the user changeset).
Adding a final Ecto.Multi.run that is responsible to automatically inject audit events is not possible too since the
changes_so_far
parameter are the results from the previous operations and not the changesets.
Using Repo.transaction() with a anonymous function does not return any changeset.