By the time someone asks who changed the amount on this record last month, it is usually months later. Whoever is asking has neither the screen as it looked then nor the build that was running, only the few rows left behind at the time. Who logged in, who changed which field from what to what, who looked at which record: every decision in the auditing layer has to assume that scene first, including the ones that look like nothing more than saving space.
This post covers:
Why the name is copied in as well, rather than storing an id and joining back for it
How one column encodes the whole outcome of a login, and why the failure reason is kept apart from the line shown to the user
Why the access record covers only single record reads, and why it is the one of the three that is off by default
Why a change is one row per save, why that write sits outside the transaction, and what happens when it fails
How what changed is stored as a DiffGram, and why there is only one place it can be captured
1.β¦