简体   繁体   English

对 MYSQL 数据库实施版本控制的最佳方法是什么?

[英]What is the best way to implement versioning to a MYSQL database?

I have to produce a versioning system to store multiple versions of my articles in a database to allow the user to roll-back if required.我必须生成一个版本控制系统来将我的文章的多个版本存储在数据库中,以允许用户在需要时回滚。 My first thoughts are when the user wants to edit an article really I get the sql to no longer update but you insert their information back into the database.我的第一个想法是,当用户真的想编辑一篇文章时,我让 sql 不再更新,但您将他们的信息重新插入数据库。 Currently the problem is i have an articles table and I am using the ID as my primary key to identify my article (so read more links and so on).目前的问题是我有一个文章表,我使用 ID 作为我的主键来识别我的文章(所以阅读更多链接等等)。 If i insert into that table I will have basicly new articles, so I am thinking I need a new table for the older articles but then I have problem of the originals in that first table dbArticles, I also need so why of telling which article they have choosen, for example if they have 3 edits so 3 articles lets all made on seperate days may 1st,2nd and 3rd how I need to show they have choosen the 2nd of May version rather than the latest on the 3rd of May.如果我插入到该表中,我将有基本的新文章,所以我想我需要一个新表来存放旧文章,但是我在第一个表 dbArticles 中遇到了原件的问题,我还需要为什么要告诉他们是哪篇文章已经选择了,例如,如果他们有 3 次编辑,那么 3 篇文章让所有在 5 月 1 日、2 日和 3 日的不同日子完成,我需要如何证明他们选择了 5 月 2 日的版本,而不是 5 月 3 日的最新版本。 Any help would be greatly receive thanks,任何帮助都会非常感谢,

Cool Hand Luke Uk酷手卢克英国

Ps I am using PHP also and I am timestamping articles:D. Ps 我也在使用 PHP 并且我正在为文章添加时间戳:D。

Have 2 tables:有2张桌子:

  • article: here you store article_id, article name and any other meta data文章:在这里您存储文章 ID、文章名称和任何其他元数据
  • article_version: Here you store each version of the article (including the original one) and link with article_version.article_id=article.article_id. article_version:在这里您存储文章的每个版本(包括原始版本)并与 article_version.article_id=article.article_id 链接。 Be sure to add a timestamp and version etc in this table.请务必在此表中添加时间戳和版本等。

If you are after versioning of textual articles, you should consider using a wiki, for example MediaWiki .如果您要对文本文章进行版本控制,则应考虑使用 wiki,例如MediaWiki They may have solved the problem for you.他们可能已经为您解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用yii php框架保持数据库版本控制的最佳方法是什么? - What's the best way to keep database versioning with the yii php framework? 在php / mysql中搜索拼写错误的最佳方法是什么? - What's the best way to implement typo correction into a search in php/mysql? 将大量变量写入MySQL数据库的最佳方法是什么? - What is the best way to write a large number of variables to a MySQL database? 用以下数据库布局在mysql中创建视图的最佳方法是什么? - What would the best way to be to create a view in mysql with the following database layouts? 将RSS源添加到MySQL数据库的最佳方法是什么? - What is the best way to get RSS Feeds into a MySQL Database 在MySQL数据库中存储特殊字符的最佳方法是什么? - What is the best way to store special characters in a MySQL database? 将多个表单数组插入MySQL数据库的最佳方法是什么? - What is the best way to insert multiple form arrays into a MySQL database? 使用PHP将iOS客户端连接到MySql数据库的最佳方法是什么? - what is the best way to connect an iOS client to a MySql database using PHP? 将缩略图与mysql数据库中的图像相关联的最佳方法是什么? - What is the best way to associate a thumbnail with an image in a mysql database? 从 mysql 数据库生成和打印数据的最佳方法是什么 - What is the best way to generate & print out data from mysql database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM