Fork me on GitHub
#datomic
<
2015-12-19
>
davebryand16:12:36

I’m still trying to wrap my head around the best way to model created-by in Datomic. Say that I have a task entity which needs to track who created it, is it idiomatic to have a :task/created-by attribute or should I use an :audit/user attribute on the transaction? Appreciate thoughts...

hkjels17:12:06

I’m no Datomic guru, but from what I’ve read, the idiomatic way seems to be to add it to the transaction-entity

zentrope20:12:30

You could have a :user/tasks card/many entity pointing to all the tasks for that user (if it's an "owned" relationship).

zentrope20:12:44

Oh, sorry. This discussion is hours old. ;)

nwjsmith22:12:42

Is there a way to do recursive queries?

nwjsmith22:12:57

I have entities category and categorization, the categorization entity relates a category with a subcategory. I’d like to be able to find all of a category’s ancestors by traversing it’s categorizations in a query

nwjsmith22:12:35

You can see the ‘flattened’ query written to find the parent, grandparent and great grandparent of a category. I’d like to generalize that though

davebryand23:12:42

thanks @hkjels and @zentrope — I’m thinking that because the notion of creation of a task is as first-class as the assignment of a task, I’m going to model this as a task attribute with :task/created-by and :task/assigned-to

zentrope23:12:47

Seems reasonable. Associating a user with a transaction itself seems more about auditing on a meta level rather than a normal data model.

zentrope23:12:14

(As in, do both, if "who made the transaction" is valuable.)