     }
 
 
-	//The data space UID can be shared between multiple Docuemnt.
+	//The document version. Allows to detect if migrations logic is required
+	@objc dynamic open var version:Int = 1
+
+	//The data space UID can be shared between multiple Documents.
 	@objc dynamic open var spaceUID:String = Bartleby.createUID()
 
 	//Defines the document UID.

    override open func encode(to encoder: Encoder) throws {
		try super.encode(to:encoder)
		var container = encoder.container(keyedBy: DocumentMetadataCodingKeys.self)
		try container.encode(self.spaceUID,forKey:.spaceUID)
		try container.encode(self.persistentUID,forKey:.persistentUID)
		try container.encode(self.currentUserUID,forKey:.currentUserUID)

		try super.init(from: decoder)
        try self.quietThrowingChanges {
			let values = try decoder.container(keyedBy: DocumentMetadataCodingKeys.self)
			self.version = try values.decode(Int.self,forKey:.version)
			self.spaceUID = try values.decode(String.self,forKey:.spaceUID)
			self.persistentUID = try values.decode(String.self,forKey:.persistentUID)
			self.currentUserUID = try values.decode(String.self,forKey:.currentUserUID)
