datomic

weavejester 2025-09-23T15:11:06.666539Z

If I have a schema in a var, and then I add an additional field to it, is it reasonable to transact the whole schema again in its entirety, or better to work out what's changed and upload only the differences?

ghadi 2025-09-24T15:06:34.844089Z

the other thing to do is to make schema ensuring part of your CICD pipeline, and not part of instance startup

ghadi 2025-09-24T15:07:01.149569Z

commit -> build -> test -> ensure-schema -> update-pods

favila 2025-09-23T15:24:36.144089Z

Datomic transactions are a DSL for describing changes not a desired end state, so your default stance should be to transact what changed. There happens to be enough upsert-y features that in many cases there's no difference.

favila 2025-09-23T15:26:07.507839Z

what is the context? Are you just tooling around in a repl? if so, just transact. Are you in a prod system? Then you should separate deploying schema from deploying applications. (Your question sounds suspiciously like the context is "I have a var holding schema that I want to transact unconditionally when the application starts up".)

favila 2025-09-23T15:27:09.938359Z

I have used https://github.com/qtrfeast/conformity with success for managing schema changes. (although using https://github.com/qtrfeast/conformity/pull/53 for when the schema got large.)

cjohansen 2025-09-23T15:54:43.542719Z

Another happy conformity user here 👋

weavejester 2025-09-23T15:58:35.880649Z

I was wondering if I could get away with not using a schema migration system like conformity if I was only ever adding to the schema. That is, if I don't need to worry about changing existing data.

favila 2025-09-23T16:00:02.866169Z

you probably can, until you can't

favila 2025-09-23T16:01:00.493149Z

the conditions for that being possible are: only assertion datoms, only on idents, and never reassign idents (e.g. outside the schema)

weavejester 2025-09-23T16:01:35.439889Z

But in general it's better to start with some sort of schema management system, in your opinion?

favila 2025-09-23T16:01:42.231149Z

yeah

favila 2025-09-23T16:04:09.518949Z

it doesn't have to be as complicated as conformity. it could be a single entity with a counter for e.g., and each transaction change is assigned a number in code, and include a :db/cas advancing the counter by one when transacting

favila 2025-09-23T16:05:15.271529Z

conformity tries to do schema and data migrations, and name each norm, and allow a granular dependency tree of them

favila 2025-09-23T16:05:29.828169Z

you may not need all that

okwori 2025-09-23T16:46:59.356449Z

Schema that consists of vars can give a good introspection of what the actual combinations of entities/attr within the system looks like if designed right. That said, you can transact the schema as much as you want with only the changes persisting, vcs is enough in most cases to monitor what changed within the schema file. Used this within a production system running for 5+ years without issues, worthy of note though is, its a small team, as there could be an argument otherwise when multiple devs change that file.

okwori 2025-09-23T17:03:38.991669Z

If you prefer going the migration lib route, adding this to the mix: https://github.com/recbus/caribou

cch1 2025-09-23T19:00:32.747409Z

We've been using caribou in production for several years. Disclaimer: I am the author.