创建上传文件的“版本”的最佳方法是什么?

时间:2022-05-13 14:09:12

In my application people will upload resumes and they can update the resumes I am storing. The resumes use a file stream in a database. That is working fine. But now I want to track versions of the uploaded resumes to find the latest and previous resume.

在我的应用程序中,人们将上传简历,他们可以更新我正在存储的简历。简历在数据库中使用文件流。这工作正常。但现在我想跟踪上传的简历的版本,以找到最新的和以前的简历。

What is the best way to do this?

做这个的最好方式是什么?

3 个解决方案

#1


What I would do if I were you, would be to add a versionNumber column to the table, and when the "Update" their resume, I would just write a new entry to the database. You should then have a column called ResumeActive or something similar as a Bit field. just mark the most recent resume as the active and mark all the others as inactive.

如果我是你,我会做的是将一个versionNumber列添加到表中,当“更新”他们的简历时,我只会写一个新的数据库条目。然后,您应该有一个名为ResumeActive的列或类似于Bit字段的列。只需将最新的简历标记为活动状态,并将所有其他简历标记为非活动状态。

Should they wish to rollback their resume to a previous version, just mark that as active and mark all the others as inactive. I hope this helps and that I understood your question correctly.

如果他们希望将简历回滚到以前的版本,只需将其标记为活动状态并将所有其他简历标记为非活动状态。我希望这有帮助,我理解你的问题。

#2


You could also use a storage engine that is aware of document versions and this be able to not only track versions but also quickly switch between them and view differences. If you're using windows for your solution you could investigate Sharepoint ($) or Sharepoint Portal Services (free)

您还可以使用知道文档版本的存储引擎,这不仅可以跟踪版本,还可以快速切换它们并查看差异。如果您使用Windows作为解决方案,您可以调查Sharepoint($)或Sharepoint Portal Services(免费)

#3


Use a normal or binary diff, and on each change, store the result of the diff in the database, with the version number. So if a user wants to revert back, apply all the diffs upto that version. This will take up lesser space than storing each version of the whole file.

使用普通差异或二进制差异,并在每次更改时,使用版本号将diff的结果存储在数据库中。因此,如果用户想要还原,请将所有差异应用到该版本。这将比存储整个文件的每个版本占用更少的空间。

#1


What I would do if I were you, would be to add a versionNumber column to the table, and when the "Update" their resume, I would just write a new entry to the database. You should then have a column called ResumeActive or something similar as a Bit field. just mark the most recent resume as the active and mark all the others as inactive.

如果我是你,我会做的是将一个versionNumber列添加到表中,当“更新”他们的简历时,我只会写一个新的数据库条目。然后,您应该有一个名为ResumeActive的列或类似于Bit字段的列。只需将最新的简历标记为活动状态,并将所有其他简历标记为非活动状态。

Should they wish to rollback their resume to a previous version, just mark that as active and mark all the others as inactive. I hope this helps and that I understood your question correctly.

如果他们希望将简历回滚到以前的版本,只需将其标记为活动状态并将所有其他简历标记为非活动状态。我希望这有帮助,我理解你的问题。

#2


You could also use a storage engine that is aware of document versions and this be able to not only track versions but also quickly switch between them and view differences. If you're using windows for your solution you could investigate Sharepoint ($) or Sharepoint Portal Services (free)

您还可以使用知道文档版本的存储引擎,这不仅可以跟踪版本,还可以快速切换它们并查看差异。如果您使用Windows作为解决方案,您可以调查Sharepoint($)或Sharepoint Portal Services(免费)

#3


Use a normal or binary diff, and on each change, store the result of the diff in the database, with the version number. So if a user wants to revert back, apply all the diffs upto that version. This will take up lesser space than storing each version of the whole file.

使用普通差异或二进制差异,并在每次更改时,使用版本号将diff的结果存储在数据库中。因此,如果用户想要还原,请将所有差异应用到该版本。这将比存储整个文件的每个版本占用更少的空间。