
Every Time You UPDATE a Row, You're Deleting History
The Problem That Wouldn't Go Away Early in a project I was working on, a customer filed a billing dispute. Simple enough, except when we went to check what subscription plan they were on at the time of the charge, we couldn't tell. Our database only stored the current state. The plan had been upgraded twice since then. The old values were gone. We weren't doing anything unusual. We had created_at and updated_at columns like every other project. But those tell you when a row changed, not what it looked like before it changed. That moment stuck with me. And I kept running into variations of it: "What was the price of this product on Black Friday last year?" "What were this employee's permissions when that action was taken?" "What did this contract say before it was amended?" The answer was always the same: we don't know. Why The Standard Fixes Are Painful Most teams handle this one of three ways, and none of them are great. The audit log table a separate table that records every change a
Continue reading on Dev.to
Opens in a new tab


