Closed handerpeder closed 2 months ago
Though this was the same as #323 but maybe not.
Trying to upsert on an entity that has a composite primary key, I would expect this to work:
(def schema {:a+b {:db/tupleAttrs [:a :b] :db/unique :db.unique/identity}}) (def conn (d/create-conn schema)) (d/transact! conn [{:a 1 :b 2}]) (d/transact! conn [{:a 1 :b 2}])
The second invocation throws
1. Unhandled clojure.lang.ExceptionInfo Cannot add #datascript/Datom [2 :a+b [1 2] 536870914 true] because of unique constraint: (#datascript/Datom [1 :a+b [1 2] 536870913 true]) {:error :transact/unique, :attribute :a+b, :datom #datascript/Datom [2 :a+b [1 2] 536870914 true]}
Since these two attributes are marked as identity, this should be an update on 1, not a new entity.
Fixed and pushed as 1.7.0
Though this was the same as #323 but maybe not.
Trying to upsert on an entity that has a composite primary key, I would expect this to work:
The second invocation throws
Since these two attributes are marked as identity, this should be an update on 1, not a new entity.