数据库条目修改历史 [英] Database entries modification history

查看:78
本文介绍了数据库条目修改历史的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个大型管理系统(在PHP中使用Zend Framework,但这并不是对这个问题的解决方案的真正启示),在该系统中,我必须管理多个条目.每个条目具有许多字段,并且在一对多关系中(通过单个外键)在两个表上具有跨度.第一个表中大约有50个字段,第二个表中有30个字段.

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.

我当时正在考虑使用一种与CMS Typo3中存在的系统类似的系统.一个表格,其中包含以下字段,用于管理整个历史记录

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
  • 数据

数据将以json或xml格式序列化".

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

推荐答案

我将添加一个阈值并将所有早于特定时间段的条目删除或转储到外部文件中.

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

这篇关于数据库条目修改历史的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆