coresmart / persistencejs

persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
http://persistencejs.org
1.73k stars 240 forks source link

loadFromJson expects unique IDs across all tables #147

Open darthtrevino opened 10 years ago

darthtrevino commented 10 years ago

It looks like the loadFromJson feature expects data rows to have unique IDs across all of the tables in the database. If there is an ID collision, then the earliest usage wins and later rows are simply not entered.

You can work around this, but it makes maintaining JSON data dumps a bit of a pain.

githugger commented 8 years ago

Correct me if I'm wrong but doesn't persistencejs generally expect unique ids across all tables? We specifically set the ids to composite values like 'tablename:tableuniqueid' to ensure a one-to-one mapping to a DB with regular constraints (unique ids within tables only).

darthtrevino commented 7 years ago

It's been a couple of years since I looked at it, but IIRC, the constraint was stronger that 'unique in the table', it was 'unique in the entire dataset'.