This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-24
Channels
- # beginners (19)
- # boot (118)
- # capetown (4)
- # cider (37)
- # cljs-dev (69)
- # cljsjs (23)
- # clojure (212)
- # clojure-austin (10)
- # clojure-india (3)
- # clojure-italy (2)
- # clojure-mke (1)
- # clojure-nl (1)
- # clojure-russia (5)
- # clojure-spec (52)
- # clojure-uk (86)
- # clojurescript (31)
- # core-async (9)
- # cursive (123)
- # datomic (91)
- # emacs (22)
- # events (3)
- # hoplon (68)
- # klipse (4)
- # lambdaisland (10)
- # leiningen (2)
- # off-topic (14)
- # om (14)
- # onyx (44)
- # perun (14)
- # proton (20)
- # re-frame (15)
- # reagent (10)
- # ring-swagger (9)
- # specter (18)
- # untangled (3)
- # vim (26)
- # yada (4)
I am new to datomic and I was trying to understand how altering schema works in datomic?
I came across this in the documentation
Because Datomic maintains a single set of physical indexes, and supports query across time, a db value utilizes the single schema associated with its basis, i.e. before any call to asOf/since/history, for all views of that db (including asOf/since/history). Thus traveling back in time does not take the working schema back in time, as the infrastructure to support it may no longer exist. Many alterations are backwards compatible - any nuances are detailed separately below.
Given this Thus traveling back in time does not take the working schema back in time, as the infrastructure to support it may no longer exist.
well what kind of schema changes are you thinking of?
usually what you'll do is to add an attribute or add an index to an existing attribute
remember the datomic schema is very lightweight
for breaking changes is often a good idea to use a new attribute, and convert the old data to the use the new attribute
Does anyone know id its possible to specify the partition when using string temp ids?
hello, what is the idiomatic way in datomic go get a monotonically increasing number? i need it for constructing order ids and stuff like that. Transaction number?
@karol.adamiec you need a transactor fn
hoped to avoid that 🙂
i am looking for something that is in datomic already that i can piggyback off. the numbers do not need to be in order, just uniqe and legible ie on the phone… guids out 🙂
here's something that you can use
{:db/id (d/tempid :db.part/user),
:db/fn (d/function '{:lang :clojure, :imports [], :requires [], :params [db eid],
:code "(let [new-number (d/q ' [:find (max ?number) . :in $ :where [_ :my.order/number ?number]] db)] [{:db/id eid, :my.order/number (inc (or new-number 0))}])"})
:db/ident :my.order/new-order}
assuming your order number attr is :my.order/number
, you can generate a new order using [:my.order/new-order]
well looks exactly like a thing i need
thank You 😄
it's not ideal btw
I wish there were default db.fn's like that, e.g. :db.fn/auto-increment
btw: hos does one manage clojure db functions? is that an issue?
migrations
i can put a function in my conformity schema, but are there any practices, workflow if that code needs to evolve?
if the code evolves, a new migration 🙂
yeah so the flow is develop a new version in repl, when happy do the migration
right
sounds good enough 🙂
it's just a function really
well yes, but passed in as string ==> which means copy and paste 😄, triggers alarms 😄
anyway good enough for today 🙂
you can just pass it as a quoted data structure
instead of a string
ha, that is way nicer
it's a string here because I got it from my db 🙂
perfect, will brush up on the api today 🙂
for exploration you can also call a fn installed in your db: http://docs.datomic.com/clojure/#datomic.api/invoke
ha, looks like a great way for an ‘integration' test
(d/invoke (rdb) :my.order/new-order (rdb) (d/tempid :db.part/user))
[{:db/id #db/id[:db.part/user -1000004], :my.order/number 16256}]
@abhir00p re: migrations, please tell me if this helps http://vvvvalvalval.github.io/posts/2016-07-24-datomic-web-app-a-practical-guide.html
@Chrisbloom To your question on specifying the partition when using string temp ids. The string temp id will use the partition that is configured as the default. So you can specify what partition all string temp ids will use, but not on a per transaction basis. http://docs.datomic.com/transactions.html#default-partition
What am I doing wrong here? http://pastebin.com/28vSPhTd
@curtosis I think Conformity is what I see most often around schema/migration discussions.
Hi, regarding s3 log rotation, what does cognitect mean with time-status-reached
on:
* Better naming convention for logrotation:
`{bucket}/{system-root}/{status}/{time-status-reached}`,
where status is "active" or "standby".
happy to announce that https://github.com/Cognician/datomic-doc is now open source!
@robert-stuttaford awesome! This looks great!
rad 🙂 hope others find it useful!
i must admit that spec is probably overkill for parsing options, but it was just so much fun to do https://github.com/Cognician/datomic-doc/blob/master/src/cognician/datomic_doc/options.clj