Fork me on GitHub
#datahike
<
2022-05-04
>
Joshua Suskalo17:05:44

So the schema-on-write section mentions that only db.cardinality and db.unique can be updated. It's unclear to me if I'm allowed to transact a schema that adds in additional fields in an accreting way. Is that permitted, and if so do I have to transact the full updated schema when I add them, or can I transact only the updates?

kkuehne12:05:14

Hey @U5NCUG8NR, you have to transact the full schema again. We have an ongoing discussion on how to handle schema updates since sometimes it is not clear how consistency can be ensured when changing something in the schema. For instance when changing db.unique all entities previous to that transaction would have a different behavior. What kind of behavior do you expect from Datahike when migrating the schema in general? We're thinking about changing some of that functionality over the summer and insights from you might help us there.

Joshua Suskalo15:05:30

Well for my own personal usecase I expect to only see acreting changes, that is adding new attributes. I don't expect to ever change old ones. That's definitely not an achievable constraint for all codebases, but for mine where I get to think about the problem space for a long time and don't expect to do many updates I can afford to do that. Most likely for my usecase all I'll have is a schema version attribute inserted and checked on startup and if it's less than the expected value I'll transact on it, and if it's equal continue, and if it's greater then the whole app will notify me and then crash.

Joshua Suskalo15:05:47

Being able to transact to change single fields would mostly be useful to me if I were to do migrations from a repl.

Joshua Suskalo15:05:57

Which is unlikely.