 
 (defn new-fs-store
   "Filestore contains a Key and a Data Folder"
-  [path  & {:keys [serializer read-handlers write-handlers config automatic-schema-update]
+  [path  & {:keys [serializer read-handlers write-handlers config]
             :or   {serializer     (ser/fressian-serializer)
                    read-handlers  (atom {})
                    write-handlers (atom {})
-                   config         {:fsync true}
-                   automatic-schema-update false}}]
-  (println "auto: " automatic-schema-update)
-  (let [_          (check-and-create-folder path)
-        old-format? (not (empty? (filter #(re-matches #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" %)
-                                                      (seq (.list (io/file path))))))
-        key-path   (str path "/meta")
-        data-path  (str path "/data")
-        _          (check-and-create-folder key-path)
-        _          (check-and-create-folder data-path)
-        store (map->FileSystemStore {:folder         path
-                                     :serializer     serializer
-                                     :read-handlers  read-handlers
-                                     :write-handlers write-handlers
-                                     :locks          (atom {})})]
-    (if (and old-format? (true? automatic-schema-update))
+                   config         {:fsync true}}}]
+  (let [_               (check-and-create-folder path)
+        key-path        (str path "/meta")
+        data-path       (str path "/data")
+        _               (check-and-create-folder key-path)
+        _               (check-and-create-folder data-path)
+        stale-binaries? (->> (io/file path)
+                             .list
+                             seq
+                             (filter #(re-matches
+                                       #"B\\_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
+                                       %))
+                             empty?)
+        stale-edn?      (->> (io/file path)
+                             .list
+                             seq
+                             (filter #(re-matches
+                                       #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
+                                       %))
+                             empty?)
+        store           (map->FileSystemStore {:folder          path
+                                               :serializer      serializer
+                                               :read-handlers   read-handlers
+                                               :write-handlers  write-handlers
+                                               :stale-binaries? stale-binaries?
+                                               :locks           (atom {})
+                                               :config          config})]
+    (if-not stale-edn?
       (do
         (go
-          (println "Updating to new store schema.")
           (<! (filestore-schema-update store))
           store))
       (go store))))
 
+
+
+
 (comment
-
-  (time (def store (<!! (new-fs-store "/tmp/old-CCCP" :automatic-schema-update true))))
+ 
+  (read-string "{:update-store {:version-12-to-14 true}}")
+
+  (time (def store (<!! (new-fs-store "/tmp/konserve-fs-migration-test"))))
+
+  store
+
+
+
+
+  store
+  (->> (io/file "/tmp/konserve-fs-migration-test")
+       .list
+       seq
+       (filter #(re-matches
+                 #"B\\_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
+                 %))
+       empty?)
+
+
+  (spit "/tmp/old-CCCP/config" "update-store :version [8.11 8.12]")
+
+  (keyword (slurp "/tmp/old-CCCP/config"))
+
+  (slurp "/tmp/old-CCCP/config")
 
   (<!! (-assoc-in store [":123"] 43))
 

      (sync-folder folder))
    nil))

(defn- binary-read [f res-ch folder fn key locked-cb]
  (if-not (.exists f)
    (close! res-ch)
    (try

  (let [fns (->> (io/file folder)
                 .list
                 seq
                 (filter #(re-matches #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
                                      %))
                 (map (fn [fn]
