Instead of making change, generate an event, that has enough information to be applied by handler… Having this stream of events allows easy log. For example at the handler level.
The gem You mentionned is triggerred by active record on create/del/update…
In the case of Event Sourcing You would need to intercept all db call, and replace by an event. The commander would sit between the requested action and the db call.
The closest You could find would be database trigger, probably. Or use RethinkDB.
The commands would be constructed in the top level module of your OTP app. It’s a pattern that fits nicely with BEAM messaging - you can send a command struct to a GenServer for instance.
If that feels like too much re-structuring, another approach would be to find all the places you are submitting Changesets to the Repo. Replace these Changesets with Ecto.Multi, which includes an additional logging operation.
How could yo rely on database triggers if the db alone can’t know who made the change for be able to log? Unless I am missing something (definitely possible)
I would like to have messages like Github Audits, so I am confused about that