How To Use Triggers to Track Changes in MySQL
codespatter.com
codespatter.com
Audit logging like this should be handled on the application level. That way you get to know who did the change, which is generally one of the most important parts of an audit trail.
Finally. Someone comes up with a technical description of how I've always felt. Thank you, dhh.
I wonder why he uses a relational database at all if he's really just using it as a bit bucket.
Rows are never deleted from the database, a soft delete is used.
When a user edits something the application does store that in the original table.
How would you propose doing it differently?
In my case, triggers and constraints are a Good Thing(TM) because our DBs are touched by different applications running on different platforms (and hardware). Maintenance is actually easier with the database triggers and constraints in place, since shared data access libraries aren't feasible.