I'm starting to develop a Datomic-backed Clojure app, and I'm wondering what's the best way to declare the schema, in order to address the following concerns:
Intuitively, my approach would be the following:
Is this the best way to go? How do people usually do it?
Raw maps are verbose, but have some great advantages over using some high level api:
spec
API.For those reasons I use raw maps.
This I don't do either.
Usually when you make a change to your schema many things may be happening:
Which may need for you to change your existing data in some non obvious and not generic way, in a process which may take some time.
I do use some automatization for applying a list of schemas and schema changes, but always in a controlled "deployment" stage when more things regarding data updating may occur.
Assuming you have users.schema.edn
and roles.schema.edn
files:
(require '[datomic-manage.core :as manager])
(manager/create uri)
(manager/migrate uri [:users.schema
:roles.schema])
I Use Conformity for this see Conformity repository. There is also a very useful blogpost from Yeller Here which will guide you how to use Conformity.
For #1, datomic-schema might be of help. I haven't used it, but the example looks promising.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With