Database entries modification history

∥☆過路亽.° 提交于 2019-12-06 16:02:46

问题


I am currently working on a big management system (in PHP using Zend Framework, but that is not really revelant of the solution to this question) in which I have to manage multiple entries. Each entry has many fields and span on two tables in a 1-to-many relationship (through a single foreign key). There is roughly 50 fields in the first table and 30 fields in the second one.

I am now at the stage to implement a history tracking of the different modifications made by users (and some automated tasks). Each entry might enventually be rolled back partially or totally to a previous value.

I was thinking about using a system similiar to the one present in the CMS Typo3. One table to manage the whole history with the following fields

  • history_id
  • entry_id
  • entry_table
  • last_modifcation_timestamp
  • last_modification_user
  • data

The data would be "serialized" in a json or xml format.

My concerns through this method is that overtime, the content of the history table would grow exponentially. To overcome this issue, I was thinking that i could make a new database to manage this history every years and then show history data by years to the users.

I am looking for advice about ways to improve this solution and ease the implementation. Any advice or documentation to help me will be welcome


回答1:


I'd add a threshold and remove or dump to an external file all entries older than a certain period of time.



来源:https://stackoverflow.com/questions/5023414/database-entries-modification-history

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!