内容版本控制
我刚刚开始一个项目,我想要一个带有版本控制的小型内容管理器。但是我不知道对数据库建模的最佳方法是什么。
我有包含以下字段的内容表: id 主键序列号, content_id int(标识不同内容的字段), 标题varchar, 内容长文本, 版本 int 默认 '1', create_date 日期,
我看到一些 CMS 将另一个表中的修订版与实际修订版分开,最好的方法是什么?有什么优化的办法吗?
谢谢!
I just starting a project, I would like to have a small content manager with version control. However I don't know what is the best way to model the database.
I have content table which contains the following fields:
id primary key serial,
content_id int (field to identify diferent contents),
title varchar,
content longtext,
version int default '1',
create_date date,
I have seen some CMS separes the revisions in another table than the actual revision, What's the best way? Is there any optimized way?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这已经存在,没有数据库:
它们都是开源的,并且都有插件架构,因此可以根据您的具体需求进行定制。 (但是,我只使用过 gitit。)不过
,我要指出的是,git 在对大型二进制文件进行版本控制方面并不完美,而 darcs 在这方面表现很糟糕。需要注意的事情。
This already exists, without a database:
They're both open source, and both have a plugin architecture, so can be customised for your specific needs. (However, I've only used gitit.)
I would however note that git is not perfect at versioning large binary files, and darcs is terrible at it. Something to watch out for.
我设计了这样的东西,这就是它的要点;
因此,该表上的每笔交易都会在 VER_CUSTOMER 表中具有相应的记录,其中 RECORD_ID 和表的自然 PK 为 PK。例如,如果 CUSTOMER 表的 PK 是 CUST_ID。 VER_CUSTOMER 的 PK 将是 CUST_ID 和 RECORD_ID 的复合。
希望这有帮助...
I designed something like this and here's the gist of it;
So every transaction that you have on that table, you have a corresponding record in VER_CUSTOMER table with RECORD_ID and table's natural PK as PK. For example if CUSTOMER table's PK is CUST_ID. PK of VER_CUSTOMER will be composite CUST_ID and RECORD_ID.
Hope this helps...