Clojurians
# datomic

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

gerrit 23:00:14

@raymcdermott: sounds interesting. I'll have a look. Thanks!

nxqd 08:49:18

hi guys, what is a good way to query the current schema in user partition ? thanks

lowl4tency 08:52:27

Hi guys!

andrewboltachev 17:40:35

Hi. Are there any migration tools for Datomic? Say, I'm in development and I'm changing my schema arbitrarily, and I want to preserve all the data though?

timgilbert 17:44:39

@andrewboltachev: I’ve been using https://github.com/rkneufeld/conformity for that (I’m a newbie though)

andrewboltachev 17:45:22

@timgilbert: interesting! Thanks

timgilbert 17:46:15

No prob. Seems to cover most of what I was using lobos for in pgsql-world. There are a few other similar tools around if you google a bit

andrewboltachev 17:48:25

Main problem is Datomic's support around schema changes, e.g. fulltext attribute once it's set

andrewboltachev 17:53:41

@timgilbert: so, would that library, say help me to (1) take all the data (2) drop existing and create a new schema (3) import preserved data, and apply transformations to it where appropriate?

timgilbert 17:54:37

Uh, sort of except for (2), to my understanding

timgilbert 17:55:11

It just basically lets you run a set of transactions on your database, and then it keeps track of which ones have already been run

timgilbert 17:55:45

But as I understand it, you don’t really drop old schema changes, since everything is immutable

andrewboltachev 17:56:20

Like I said, there are cases where you can't apply a change to the schema

timgilbert 17:56:24

So transactions can include schema updates, and oalso adding new data from somewhere

timgilbert 17:56:48

Not sure about that, I’ll defer to someone with more expertise

andrewboltachev 17:57:08

Ok, thanks anyway!

timgilbert 17:57:15

No prob, good luck

andrewboltachev 18:04:19

My real situation is like this: (0) I have an idea about an (web) app I want to build
(1) I'm starting to with "categories". And I want to have schema to save categories and make categories widgets first (2) I realize that there would be "collapsed" flag for each category (in category widget, is it collapsed or not) — need to add new attribute (3) I'm finished with the widget and I want to add "items" entity. (4) Adding users to my project (5) Say, categories list (or tree, or graph ['cause yep, there's no tree]) is common for all users, but each has own ones collapsed-or-not. So, thus "collapsed" flag must be turned to some relation then.

Could I achieve (5) (and all of the above) without creating new DB?

andrewboltachev 18:08:54

And, have old data preserved (say, I added bunch of categories)?

andrewboltachev 18:13:24

Also, interesting thing is that this way of development I just described is sort of "Agile", i.e. categories, items and users are "features". According to Rich Hickey we should be solving problems, not building features. So, is my way fundamentally incorrect, i.e. I should first imagine what my app would operate (design it) and then implement it (so no changes to DB like that would arise)? Would much appreciate any answers/opinions.

jonahbenton 18:18:31

@andrewboltachev: hey andrew- definitely don't go in the "waterfall" direction of having heavy "design" and "implementation" cycles. instead, tune your workflow to make it easy to try, discard, and try again. use datomic in mem mode, or even datascript, to iterate on a data model, and separately, if you need to "seed" your data model to test your app, keep the seed datoms in an edn file and just transact them at app startup

andrewboltachev 18:20:19

@jonahbenton: so, you say I'll be able to switch to Datomic when finally ready to production?

andrewboltachev 18:22:50

Well, seems like easiest approach

andrewboltachev 18:22:59

w/o need for external tools

andrewboltachev 18:24:36

One big thing is confidence, though. Whoever said that building and deploying an app must not be harder than in 1-click.

jonahbenton 18:31:22

yes, you can use Datomic in a "disposable" mode as you iterate through design and implementation, and even when you first show it to users in 1-on-1s. getting positive user feedback, and being comfortable with your feature set, helps build confidence. when you have confidence to capture user data durably, then you can switch Datomic to a durable storage

jonahbenton 18:32:51

but you don't want to saddle yourself with unnecessary workflow obstacles while getting to that place, because then you will lose momentum

andrewboltachev 18:35:27

Well, seems I have an idea (and some thesis) for a library (but I'll probably build it for SQL, at least first). 'Cause migrations is what I missed in Clojure world, when switching from Python/Django. Thanks for help @jonahbenton ! I'll take into account what you've answered