I think I'm missing something about how :tupleAttrs work:
(-> (ds/empty-db {:a+b {:db/tupleAttrs [:a :b]
:db/unique :db.unique/identity}})
(ds/with [{:a "A", :b "B"}])
:db-after
(ds/with [{:a "A", :b "B" :x 3}]))
;;ExceptionInfo Cannot add #datascript/Datom [2 :a+b ["A" "B"] 536870914 true] because of unique constraint: (#datascript/Datom [1 :a+b ["A" "B"] 536870913 true])
I want to use the tuple as a lookup ref, but this seems to prevent me from adding more facts to the entity identified by the tuple?
;;; Works with a non-tuple attribute
(-> (ds/empty-db {:a {:db/unique :db.unique/identity}})
(ds/with [{:a 1}])
:db-after
(ds/with [{:a 1 :b "B"}]))Hmmm looks like this is discussed here: https://forum.datomic.com/t/upsert-behavior-with-composite-tuple-key/1075/3
Also further discussed here: https://clojurians-log.clojureverse.org/datomic/2019-11-26 I guess the answer is to manually add :a+b when transacting an entity to upsert it