Skip to content

db.fn/retractEntity should also retract references to the entity #18

@pangloss

Description

@pangloss

Something like this:

(defn- retract-refs-to-entity [db v]
  (let [schema (:schema db)]
    (sequence
      (comp
        (filter #(= :db.type/ref (get-in schema [(.-a %) :db/valueType])))
        (map (fn [d] [:db/retract (.-e d) (.-a d) v])))
      (d/-search db [nil nil v]))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions