 
 (defn- update-current [db features]
   (try
-    (let [transform-fn (juxt pg/to-json :_valid_from :_valid_to :_tiles :_dataset :_collection :_id)
+    (let [transform-fn (juxt pg/to-json :_version :_valid_from :_valid_to :_tiles :_dataset :_collection :_id)
           records (map transform-fn features)]
       (j/execute! db (cons (update-current-sql) records) :multi? true :transaction? false))
     (catch java.sql.SQLException e (j/print-sql-exception-chain e))))
 
 (defn- new-history-sql []
-  (str "INSERT INTO " (qualified-history) " (dataset, collection, feature_id, valid_from, valid_to, feature, tiles)
-VALUES (?, ?, ?, ?, ?, ?, ?)"))
+  (str "INSERT INTO " (qualified-history) " (dataset, collection, feature_id, version, valid_from, valid_to, feature, tiles)
+VALUES (?, ?, ?, ?, ?, ?, ?, ?)"))
 
 (defn- new-history [db features]
   (try
-    (let [transform-fn (juxt :_dataset :_collection :_id :_valid_from :_valid_to pg/to-json :_tiles)
+    (let [transform-fn (juxt :_dataset :_collection :_id :_version :_valid_from :_valid_to pg/to-json :_tiles)
           records (map transform-fn features)]
       (j/execute! db (cons (new-history-sql) records) :multi? true :transaction? false))
     (catch java.sql.SQLException e (j/print-sql-exception-chain e))))

               [:dataset "varchar(100)"]
               [:collection "varchar(255)"]
               [:feature_id "varchar(100)"]
               [:valid_from "timestamp without time zone"]
               [:valid_to "timestamp without time zone"]
               [:feature "text"]

(defn- update-current-sql []
  (str "UPDATE " (qualified-current) "
SET feature = ?,
    version = ?,
    valid_from = ?,
    valid_to = ?,
    tiles = ?
