Why I enforce my ledger's invariant twice
The naive approach
When I started thinking about how to track balances, the first thing I reached for was a single UPDATE:
UPDATE accounts SET balance = balance + 100 WHERE id = 42;
It works. Unt
rithvikronaldo.dev7 min read