Im creating version control for the data in our database. It will be able to store revisions, rollbacks, and rollback rollbacks. Im database tables to be reviewed are below:
objects
object_chunks
object_attributes
Objects are the main object, chunks are grouped into sections of the object, and attributes are data attributes within the chunk. Attributes store the identifier of the object along with the fragment identifier in this way. Its easy to select all the attributes for an object without making another JOIN in the pieces table.
The only thing that will ever really change is the attributes, but when the attribute changes, the affected fragments will be updated, and whenever the piece is updated, the object is also updated. Now I have thought of two different ways to solve this problem.
- Create three new tables with the suffix _rev, these tables will simply store older versions of objects. Real objects will also store the turnover number. So let's say that I changed three different attributes, these attributes are distributed in three pieces, so there are three new lines in pieces, three in attributes and one in the revision object. Since this is the first change, the rev identifier will be 1, in real tables their turnover will be 2.
- Id just does this, but instead of a separate table, Id just stores it in the same table.
, , 1 100+. 1-15. 0 100+. , , 30. . "", . , . . , (sha256) . .