Versioning internals

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

For versioned documents (with workflow assigned), only the published data is stored in the tables described in chapter Content management internals. Document versions and its history are stored in separate tables:

 

CMS_VersionHistory – Table containing the document versions. Each version of the document is represented by one record that contains the complete document data in XML.

 

CMS_AttachmentHistory – Table containing the attachment version records. Each attachment version is bound to one or more document versions. Every record contains binary data of the attachment.

 

CMS_VersionAttachment – Table containing the bindings of the attachment versions to the document versions.

 

devguide_clip1121

 

When the document is published, version history record is taken and the document data are saved to the regular database structure (CMS_Tree, CMS_Document, coupled table) and current attachments are replaced by the attachment versions corresponding to the published document version.

 

Working with the versioned documents

 

Since the TreeNode methods can work only with the published records, there is an interface provided to work with the versioned documents. This interface is provided by classes DocumentHelper, WorkflowManager and VersionManager in the CMS.WorkflowEngine library. You should always use DocumentHelper for the document operations if not sure whether the document is versioned or not, the DocumentHelper methods will choose the proper actions for you. Basic methods to work with documents are:

 

InsertDocument – Inserts a new document; versioned equivalent to TreeNode.Insert method.

 

InsertNewCultureVersion – Inserts a new culture version of the document; versioned equivalent to TreeNode.InsertAsNewCultureVersion method.

 

UpdateDocument – Updates a document; versioned equivalent of the TreeNode.Update method. If the document is versioned, it updates the latest (checked out) version of the document.

 

DeleteDocument – Deletes a document. Versioned equivalent to the TreeNode.Delete which also deletes the depending records from the version history and attachment tables. You should always use this method to delete a document which is (was) versioned or contains any attachment fields.

 

GetDocument(s) – Gets the latest version of the document(s) from the version history record(s). Equivalent to TreeProvider.SelectSingleNode and TreeProvider.SelectNodes.

 

Page url: http://devnet.kentico.com/docs/devguide/index.html?versioning_internals.htm