I am trying out excise like this:
First, I create a schema and some test data (I am using the Clojure REPL to run this)
(require '[datomic.client.api :as d])
(def client (d/client {:server-type :datomic-local
:system "dev"}))
(d/create-database client {:db-name "vehicles"})
(def conn (d/connect client {:db-name "vehicles"}))
(def vehicles-schema [{:db/ident :customer/id
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one
:db/doc "The id of the customer"}
{:db/ident :customer/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The name of the customer"}
{:db/ident :customer/vehicles
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many}])
(d/transact conn {:tx-data vehicles-schema})
(def test-customers [{:customer/id #uuid "6ea61f1a-32cb-4aa0-8c25-a5614ca2bb10"
:customer/name "John Doe"}
{:customer/id #uuid "47b8b1bb-7819-445e-abdf-61184192566b"
:customer/name "Ada Lovelace"}])
(d/transact conn {:tx-data test-customers})
If I run this query, I can see the 2 customers:
(def db (d/db conn))
(def all-customers-q '[:find ?customer ?id ?name
:where
[?customer :customer/id ?id]
[?customer :customer/name ?name]
])
(d/q all-customers-q db)
Result:
[[83562883711053 #uuid "47b8b1bb-7819-445e-abdf-61184192566b" "Ada Lovelace"] [83562883711052 #uuid "6ea61f1a-32cb-4aa0-8c25-a5614ca2bb10" "John Doe"]]
I would now like to excise one of the customers. I tried running:
[{:db/excise 83562883711053}]
I also tried:
(d/transact conn [{:db/excise 83562883711053}])
Every time, when I run (d/q all-customers-q db)
after that, I still see the 2 customers. What am I doing wrong?
I also read about sync-excise, but I don’t know how to run that.