This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-10
Channels
- # announcements (8)
- # aws-lambda (4)
- # babashka (60)
- # beginners (65)
- # braveandtrue (5)
- # chlorine-clover (3)
- # cider (10)
- # clj-kondo (2)
- # cljdoc (2)
- # cljfx (32)
- # cljsrn (5)
- # clojure (198)
- # clojure-berlin (10)
- # clojure-europe (22)
- # clojure-france (1)
- # clojure-losangeles (33)
- # clojure-nl (3)
- # clojure-norway (22)
- # clojure-uk (35)
- # clojurescript (12)
- # code-reviews (14)
- # core-typed (1)
- # cursive (56)
- # datomic (13)
- # depstar (7)
- # emacs (1)
- # events (1)
- # figwheel-main (3)
- # fulcro (30)
- # graphql (15)
- # helix (1)
- # jobs (5)
- # juxt (6)
- # kaocha (14)
- # klipse (2)
- # malli (12)
- # off-topic (88)
- # portal (4)
- # re-frame (3)
- # reagent (5)
- # shadow-cljs (6)
- # specter (6)
- # sql (73)
- # tools-deps (15)
- # windows (4)
I am trying to update schema to add uniqueness to an attribute like so:
[{:db/id :owsy/dot-number
:db/unique :db.unique/identity}]
but I get the following error:
clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: :db.error/invalid-alter-attribute Error: {:db/error :db.error/unique-without-index, :attribute :owsy/dot-number} {:succeeded [{:norm-name :V20200901/clearfork-last-funded-date-SNAPSHOT, :tx-index 0, :tx-result {:db-before datomic.db.Db@ad33f60, :db-after datomic.db.Db@d3dfdde3, :tx-data [#datom[13194140022304 50 #inst "2020-09-10T18:17:17.664-00:00" 13194140022304 true] #datom[13194140022304 72 :V20200901/clearfork-last-funded-date-SNAPSHOT 13194140022304 true] #datom[13194140022304 73 0 13194140022304 true] #datom[456 44 true 13194140022304 true] #datom[0 19 456 13194140022304 true]], :tempids {-9223354444669732589 13194140022304}}}], :failed {:norm-name :V20200901/clearfork-last-funded-date-SNAPSHOT, :tx-index 1, :reason "java.lang.IllegalArgumentException: :db.error/invalid-alter-attribute Error: {:db/error :db.error/unique-without-index, :attribute :owsy/dot-number}"}}
This is confusing because I thought that adding :db/unique would also set :db/index true
@davewo I think it's saying that your data isn't already unique :db.error/unique-without-index
so you can't add a uniqueness constraint
https://docs.datomic.com/on-prem/schema.html#schema-alteration "In order to add :db/unique, you must first have an AVET index including that attribute."
and because those indexes are added asynch, adding the :db/index
in the same tx doesn't work (which I tried)
Is there anyway to clone an in memory peer connection? Lets say I want to transact a large schema and then be able to make clones of it at that point for testing purposes and not incur the schema transaction cost each time?
@U083D6HK9 cool, I’ve run across this lib a couple times but I guess it never sunk in what usecase it solved 😄
@colinkahn Have you considered using the new dev-local database? Copying a database is literally cp my-db the-copy-of-my-db
I just saw that today. I’ve been using https://github.com/ComputeSoftware/datomic-client-memdb for testing, but they’re saying to switch over to dev-local. But at first glance seems like it writes to disk which I don’t need for tests.
Whait, copying Datomic dbs is no longer O(1) ? What a pity :)