Note that there are some explanatory texts on larger screens.

plurals
  1. POVersion control of a large collection in a database for undo purpose
    primarykey
    data
    text
    <p>In have entities: <code>Collection</code> and <code>Item</code>. Each collection has many items. Both <code>Collection</code> and <code>Item</code> can be edited collaboratively by all users of the application. I have to provide a way to undo changes. Versioning <code>Item</code> records is straightforward, the difficult part is to version the relation between the <code>Collection</code> and <code>Item</code>.</p> <ul> <li>The allowed operations on the collection are: to <strong>insert an item at given position</strong>, to <strong>remove an item</strong> and to change a position of an item within the list (which can be seen as an insert at position + a delete at previous position pair).</li> <li>The insert operation will be called frequently. Sometimes a batch import can insert thousands of items into the collection. I should be able to revert such import and the undo shouldn't take much time to be executed.</li> <li>The list can consist of 20 000 and more items. I rather can't afford to copy the entire collection on each change.</li> <li>I should be able to see the state of a given revision of collection to discover changes that were in the revision. </li> </ul> <p>How to model this in a relational database?</p> <p>I have been thinking about using a multi-valued <a href="http://martinfowler.com/eaaDev/TemporalProperty.html" rel="nofollow noreferrer">Temporal Property</a>. Beside <code>Collection</code> and <code>Item</code> there is a link table with <code>vt_from</code> and <code>vt_to</code> time stamps. Probably I would have to create also a <code>CollectionVersion</code> entity, also with <code>vt_from</code> and <code>vt_to</code> attributes. Those versions would be listed on the "history" page of the collection. However, I haven't came up yet with a general algorithm for reverting changes. Maybe I should have diff lists (added/removed) connected to the <code>CollectionVersion</code> that would be used for that purpose?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload