Fork me on GitHub

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...


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


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


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


Is there a way to do recursive queries?


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


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


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


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


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