Skip to content

Create a schema file for an existing annotated ON PREM database from a REPL

Jarrod edited this page Sep 15, 2022 · 3 revisions

Include the schema cartographer library as a dependency in your project. Then from a repl:

(ns your-namespace
  (:require
    [datomic.api :as d]
    [schema-cartographer.core :as cartographer]))

(def db-uri "datomic:sql://<<YOUR-DB>>?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic")
(def conn (d/connect db-uri))
(def db (d/db conn))

;; Arguments to the save-explore-schema-edn
;; 1) `db` 
;; 2) `path` to save the resulting schema file to
;; 3) db-type this should be :on-prem
(cartographer/save-schema-edn db "resources/db-schema.edn" :on-prem)

Progress will be logged to the repl while the utility is running.

Load the resulting output file in the UI that resides at https://schema-cartographer.com