-
Notifications
You must be signed in to change notification settings - Fork 13
Create a schema file for an existing unannotated ON PREM database from a REPL
Jarrod edited this page Sep 15, 2022
·
6 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) `ref-search-limit` This is the number of referenced entities to inspect when creating relationships maps can be `nil` for no limit. If `nil` this could take a LONG time for large databases
;; 4) `db-type` this should be :on-prem
(cartographer/save-explore-schema-edn db "resources/db-schema.edn" 2000000 :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