我想创建一个简单的版本控制系统,我想知道一些简单而优雅的设计模式。
由于大量代码正在使用这些表,所以我需要保持它们完整,否则所有现有查询都会中断。我刚在想:
-Duplicate the schema for existing tables but append Versioning to the names and a version col
-Deploy a script to copy all existing data into the Version tables as version 1.0
-Allow users to save as a new version or rollback to a previous one
-If they choose to rollback to an existing one I just update the original Tables data from the versioning tables for that version
-If they choose to save a new version, I create new records in the Version tables and update the original afterwards
我知道这不是一种有效的方法,所以有人有更优雅的解决方案吗?