This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-11
Channels
- # aleph (38)
- # announcements (6)
- # aws (1)
- # beginners (47)
- # calva (21)
- # cider (47)
- # cljs-dev (18)
- # clojure (40)
- # clojure-europe (7)
- # clojure-india (2)
- # clojure-italy (9)
- # clojure-nl (11)
- # clojure-norway (2)
- # clojure-sanfrancisco (1)
- # clojure-spec (17)
- # clojure-sweden (2)
- # clojure-uk (73)
- # clojurescript (10)
- # cursive (6)
- # datascript (12)
- # datavis (2)
- # defnpodcast (1)
- # duct (5)
- # emacs (36)
- # figwheel (2)
- # figwheel-main (10)
- # juxt (12)
- # leiningen (1)
- # midje (1)
- # nrepl (9)
- # off-topic (25)
- # pedestal (3)
- # portkey (3)
- # quil (2)
- # re-frame (45)
- # reagent (1)
- # ring (3)
- # ring-swagger (36)
- # rum (1)
- # shadow-cljs (48)
- # spacemacs (1)
- # speculative (50)
- # testing (2)
- # tools-deps (27)
- # yada (4)
Why do lookup-refs not work as in the following:
(def conn1 (make-db
[{:name {:db/unique :db.unique/identity}}]
[{:name "Bob"}]))
(d/entity (d/db conn1) [:name "Bob"])
#error {:message "Lookup ref attribute should be marked as :db/unique: [:name \"Bob\"]", :data {:error :lookup-ref/unique, :entity-id [:name "Bob"]}}
(defn make-db [schema data]
(let [conn (d/create-conn)]
(d/transact! conn (concat schema data))
conn))
@fenton - The schema should not be [{:name {...}}]
, just rather just {:name {...}}
.
...and should be in the (/d/create-conn)
as opposed to in a (d/transact! conn ...
too...
Correct
Datascript does not have dynamic schema
It's fixed at db/conn value creation
In Datomic, the schema is live, and you update it by submitting transactions, so it's entirely possible you were lead to believe you could do this by having seen some Datomic documentation/code