This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-23
Channels
- # admin-announcements (3)
- # beginners (35)
- # boot (87)
- # cider (84)
- # cljs-dev (6)
- # clojure (70)
- # clojure-austin (3)
- # clojure-italy (11)
- # clojure-japan (6)
- # clojure-korea (16)
- # clojure-russia (87)
- # clojurebridge (1)
- # clojurescript (122)
- # core-async (112)
- # cursive (2)
- # datomic (46)
- # editors (6)
- # jobs (2)
- # ldnclj (8)
- # re-frame (1)
- # reagent (1)
I’m trying to download datomic distro
wget error: 20 redirections exceeded.
are schema alterations not supported for datomic:mem
databases?
@lowl4tency: you can increase the # of allowed redirects by including
bostonaholic: what happens when you try?
no mention of a restriction in the docs
datomic.impl.Exceptions$IllegalArgumentExceptionInfo: :db.error/not-an-entity Unable to resolve entity: :foo in datom [:foo :db/ident :bar]
mind sharing the code that produced that?
the + button on the slack text input has a snippet paste
{:db/id :foo
:db/ident :bar}
that's my "alteration"
{:db/id [:db/ident :foo] :db/ident :bar}
try that
marshall: thank you, i’ve already get it through my laptop
@robert-stuttaford: Unable to resolve entity: [:db/ident :foo] in datom [[:db/ident :foo] :db/ident :bar]
a little backstory, I'm trying to load the schema for tests. transacting the schema is happening through https://github.com/rkneufeld/conformity
what does (d/pull db [:db/ident :foo] ‘[*])
produce?
ah. altering schema has specific syntax. also, conformity will only ever load a given named norm once
http://docs.datomic.com/schema.html search Alter schema
yeah, I use the alter schema with conformity just fine for the production app
:app/v3 {:txes [[{:db/id :foo
:db/ident :bar}]]}
ok. were i in your shoes, i’d first validate the db actually has :foo in it. does it? 😁
stranger things have happened to me
yeah, that's where I'm heading now
@bostonaholic: schema alteration on mem should work — example
(ns datomic-manual-tests.mem-schema-alteration
(:require [datomic.api :as d]))
(def db-uri "datomic:")
(d/create-database db-uri)
(def conn (d/connect db-uri))
(def schema [{:db/id (d/tempid :db.part/db)
:db/ident :person/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}])
@(d/transact conn schema)
(def pname-id
(-> (d/db conn)
(d/pull [:db/id] :person/name)
:db/id))
(def alter-tx [{:db/id :person/name
:db/ident :person/first-name
:db.alter/_attribute :db.part/db}])
@(d/transact conn alter-tx)
(-> (d/pull (d/db conn) [:db/ident] pname=id)
:db/ident)
; :person/first-name
you just don’t need to sync to wait for results like you do with durable storage
I wonder if it's because my alteration tx doesn't include :db.alter/_attribute :db.part/db
Well, if you change e.g. cardinality, uniqueness, index you should get this specific error:
java.lang.IllegalArgumentException: :db.error/invalid-attribute Schema change must be followed by :db.install/attribute or :db.alter/attribute […]
yeah, I'm just renaming
renaming shouldn’t require alter then, actually: http://docs.datomic.com/schema.html#renaming-an-identity
I wonder if this is because conformity isn't transacting each norm in the order I'm assuming it is
since it's a map of norm-name:transactions
so when it's trying to rename a datom :foo
and conformity hasn't transacted the definition of :foo
@bostonaholic: As I recall, Conformity uses declared dependencies of schema sections to determine order.
@stuartsierra: hmm, I can't find in the docs how I declare a dependency
@bostonaholic: Yeah, neither can I. I must be thinking of something else.
I guess it's transacting them in the order you give to ensure-conforms
I give ensure-conforms
my map that looks like:
{:app/v1
{:txes [[{...}
{...}]]}
:app/v2
{:txes [[{...}]]}}
and since it's a map, comformity cannot guarantee that :app/v1
is transacted before :app/v2
thanks for you help everyone