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
got it, confused by docs on this...
It's fixed at db/conn value creation
okay cool, phew! 🙂
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
yeah...for sure... i guess datascript documentation is a bit fragmented...