Fork me on GitHub
#datomic
<
2016-11-07
>
rnandan27305:11:35

any notes on using postgress on heroku with datomic. pointers can also help

matthavener05:11:41

rnandan273: there are buildpacks out there you can use

matthavener05:11:56

Handles most of it

pesterhazy07:11:24

@teng, honestly I'm now just adding attributes, created-at and updated-at

pesterhazy07:11:50

Saves you a lot of hassle, and is faster to query

tengstrand07:11:29

@pesterhazy An idea I had was to store the transaction id instead and then “join” it with the transaction entity to get the date/time. That felt more right to me, but maybe there are downsides to that?

pesterhazy07:11:05

I wouldn't rely on that

pesterhazy07:11:30

When making db dumps, entity ids get changed

pesterhazy07:11:49

Not normal backups but selective db dumps

pesterhazy07:11:33

Also you'd have to update the entity each time you update as the transaction changes

pesterhazy07:11:05

So you might as well store the date directly

pesterhazy07:11:35

Relying on transaction metadata makes it harder to re-transact data without losing information

tengstrand07:11:47

They should have a similar thing as d/basis-t for entities (the current t for an entity), then you could just join in the transaction and get the date/time.

pesterhazy07:11:31

I think it's best to avoid relying on metadata except for audit and historical analysis

pesterhazy07:11:05

For example transact the user name that initiated the tx

pesterhazy07:11:16

For that kind of thing it's awesome

tengstrand07:11:19

So some type of dumps recreates all the transaction id’s, which makes it a bad idea to store transaction ids as facts?!

pesterhazy07:11:22

That's just my opinion

pesterhazy07:11:09

But think of the use case of recreating a db selectively

pesterhazy07:11:34

Or developer db dumps for testing

tengstrand07:11:55

Makes sense.

tengstrand07:11:59

Can I ask the database to give me the current date/time? Otherwise, it can be a problem if I’m running more than one transactor on different machines (if their clock is not in sync).

pesterhazy08:11:07

Yes, in a db.fn that should work

pesterhazy08:11:09

You could create a touch fn that updates the timestamp for you

pesterhazy08:11:03

Note that the fn will run on the transactor

pesterhazy08:11:39

But only one transactor is ever active so there shouldn't be contention there

timgilbert17:11:38

Say is there a predicate I can use that will tell me whether a value is an entity returned from (d/entity) or not?

timgilbert17:11:41

Hmm, looks like #(instance? datomic.Entity %) does it. I do peculiarly get a NullPointerException doing #(satisfies? datomic.Entity %) for some reason though

timgilbert17:11:04

Ah, because it's a class. The wording of this in the docs led me to believe it was an attribute. http://docs.datomic.com/clojure/index.html#datomic.api/entity