Feature #13109

Updated by Lucas Di Pentima about 3 years ago

See [[Collection version history]]

For some types of collections, particularly things like reference data, it is desirable to keep old versions around if they are updated.

h2. User-facing features

* A collection has a current version number, so that the pair (uuid, version_nr) is be enough as a reference to a specific version of a particular collection.
* Whenever a collection get its @manifest_text@, @description@, @properties@ or @name@ fields updated, a new version is created (a 'snapshot' of the collection-to-be-changed record is created pointing to the updated, most current version.)
* The user can request a collection via an API call that includes past versions.
* The user can search on collections including past versions.
* Whenever a collection changes owner, owners, uuid, storage classes, replication levels and trashed status, its past versions follow it.
* In order to modify a past version, the user needs to copy it into a new collection.

h3. On workbench

* A new 'History' tab show the currently viewed collection position on a list of versions.
* The collection's main pane show an indication if its the current version or an old one.
* When viewing a past version, if data blocks aren't retained, disable view/download buttons on the File tab, also indicating the data blocks aren't available.
* 'Copy to project...' button should also be disabled when data blocks aren't retained.
* New button 'Expunge data' on old versions with a confirmation dialog explaining what's about to happen.

h2. System wide configurations

* Flag to enable version history retention (OFF by default)
* Flag to enable data blocks retention on old versions. (ON by default?)
* Flag to allow users to drop data blocks retention on old versions of a collection.

h2. Implementation details

* All past versions go on the same collections table (so it's easier to do paging)
* New column @current_version_uuid@ to hold the current version's UUID.
* New column @version_number@ to hold a consecutive integer, starting at 1 for new collections.
* New boolean column @data_blocks_retained@ as a hint for @keep-balance@ to keep/delete old version's blocks. Can be updated only from True to False?

* The following fields are synced with their past versions counterparts: replication_*, storage_classes_*, trash_at/delete_at/is_trashed, owner_uuid, uuid (update current_uuid to retain database consistency)
* Old versions with the same name shouldn't conflict with each other or other collections.