merged.
This commit is contained in:
@@ -52,4 +52,18 @@
|
||||
id))
|
||||
(->graphql))))
|
||||
|
||||
(defn merge-vendors [context {:keys [from to]} value]
|
||||
(let [conn (d/connect uri)
|
||||
transaction (->> (d/query {:query {:find '[?x ?a2]
|
||||
:in '[$ ?vendor-from ]
|
||||
:where ['[?x ?a ?vendor-from]
|
||||
'[?a :db/ident ?a2]]}
|
||||
:args [(d/db conn)
|
||||
from]})
|
||||
(mapcat (fn [[src attr]]
|
||||
|
||||
[[:db/retract src attr from]
|
||||
[:db/add src attr to]])))
|
||||
transaction (conj transaction [:db/retractEntity from])]
|
||||
@(d/transact conn transaction)
|
||||
to))
|
||||
|
||||
Reference in New Issue
Block a user