From f85c748aaf96d918c9382d6a7261f676d8e9abf5 Mon Sep 17 00:00:00 2001 From: Christian Weilbach Date: Wed, 11 Sep 2024 14:10:55 -0700 Subject: [PATCH] Allow config setting to disable consistency check. (#693) * Allow config setting to disable consistency check. * Add documentation to config mismatch error. --- src/datahike/connector.cljc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/datahike/connector.cljc b/src/datahike/connector.cljc index 95c41264..5d0194f1 100644 --- a/src/datahike/connector.cljc +++ b/src/datahike/connector.cljc @@ -127,7 +127,7 @@ config (update config :store ds/store-identity) stored-config (update stored-config :store ds/store-identity)] (when-not (= config stored-config) - (dt/raise "Configuration does not match stored configuration." + (dt/raise "Configuration does not match stored configuration. In some cases this check is too restrictive. If you are sure you are loading the right database with the right configuration then you can disable this check by setting :allow-unsafe-config to true in your config." {:type :config-does-not-match-stored-db :config config :stored-config stored-config @@ -184,7 +184,8 @@ [config store stored-db])) [config store stored-db])) _ (version-check stored-db) - _ (ensure-stored-config-consistency config (:config stored-db)) + _ (when-not (:allow-unsafe-config config) + (ensure-stored-config-consistency config (:config stored-db))) conn (conn-from-db (dsi/stored->db (assoc stored-db :config config) store))] (swap! (:wrapped-atom conn) assoc :writer (w/create-writer (:writer config) conn))