Fork me on GitHub
#datascript
<
2021-09-14
>
danbunea13:09:18

Hi, I have a question about syncing Datomic (Cloud) data to Datascript. I found an article saying: “Datomic entity IDs can be larger than JavaScript’s`Number.MAX_SAFE_INTEGER`” which means he needed to use a workaround (string). Is this still a problem, are there other solutions?

Braden Shepherdson15:09:47

this is definitely still a problem; JS doesn't guarantee integers larger than 29 bits or something, and Datomic uses 64-bit IDs for everything.

Braden Shepherdson15:09:56

so generally I'd say that whatever API you're using to sync Datomic data to DataScript should convert IDs to strings. it's less obvious what to do with actual data values.

Braden Shepherdson15:09:55

I mean, a :db.type/long field has the same problem. your data may not be too big though.

danbunea15:09:33

Thank you Braden, I’ll use the string strategy then.

Josh20:09:10

I’ve done something similar before, we added a unique attribute :ent/uid (uuid’s or some other uniquely generated string) to every entity and dropped the db/ids when syncing