Problem Statement
What should a practical audit trail capture for data changes?
Explanation
A good audit entry ties user, timestamp, target, and the change. Use append-only audit tables or built-in extensions. Keep the path tamper-evident and searchable.
Code Solution
SolutionRead Only
INSERT INTO audit_log(actor, action, table_name, row_id, old_val, new_val) VALUES (current_user, 'UPDATE', 'orders', :id, :old, :new);
Practice Sets
This question appears in the following practice sets:
