Effective strategy for leaving an audit trail/change history for DB applications?

后端 未结 6 1645
有刺的猬
有刺的猬 2020-12-13 14:22

What are some strategies that people have had success with for maintaining a change history for data in a fairly complex database. One of the applications that I frequently

6条回答
  •  借酒劲吻你
    2020-12-13 15:14

    In the past I have used triggers to construct db update/insert/delete logging.

    You could insert a record each time one of the above actions is done on a specific table into a logging table that keeps track of the action, what db user did it, timestamp, table it was performed on, and previous value.

    There is probably a better answer though as this would require you to cache the value before the actual delete or update was performed I think. But you could use this to do rollbacks.

提交回复
热议问题