Closed romanov closed 9 years ago
Overriding the generates id with your own should work fine. As long as you make sure it's unique across the entire database, not just one table. — Zef
Sent from my iPhone
On Sun, Jul 6, 2014 at 3:31 PM, romanov notifications@github.com wrote:
Hello! Great ORM! Looks like that persistentjs is always generating own unique identifier (example:176E2AA5E9364CDDB546CE2F4E33E14D). I don't like to use auto-increment and uniq string as index. I prefer to use manually generated INTs for a database consistency in the future.
So, is it possible to generate (replace) ID with own ID field and generate it before "add" and "flush"?
Reply to this email directly or view it on GitHub: https://github.com/coresmart/persistencejs/issues/153
@zefhemel thank you for your comment
I've updated my question about sorting, i am not sure - but what sorting alg. persistencejs is using by default for IDs (alphabeat)? After number 1 goes 10 instead 2.
Hello! Great ORM!
Looks like that persistentjs is always generating own unique identifier (example:176E2AA5E9364CDDB546CE2F4E33E14D).
I don't like to use auto-increment / uniq string as index. I prefer to use manually generated INTs for a database consistency in the future.
updated
I've just overrided ID before adding and flushing item... then i need to get last id for a new item:
it's works fine before Id 10... returns 9
order returns: 1,10,2,3,4,5,6,7,8,9