3 ms·
This is really interesting. What are the tradeoffs of generating the unique ID uuid's from the database vs from the code? Compared to ORM's, is one of the mai
by stadium 5y ago
This is really interesting.
What are the tradeoffs of generating the unique ID uuid's from the database vs from the code?
Compared to ORM's, is one of the main differences that the db objects define the types and constraints and those propagate out to the code? And ORM's start with code and propagate out to the DB?
- yasserf 5y agoHonestly I don't know what the tradeoffs are . I usually rely on the db to create the id (regardless if its SERIAL / UUID). The only time I get create a UUID outside is if the client needs a UUID in its initial state. For example if tracking a users progress through a form it allows you to skip a useless creation roundtrip in order to perform the first update). Yeah thats pretty much it! Less code in the functions -> less inconsistencies with the db. And for example removing an enum in the db would fail all your front end components using it, so it's really across the whole pipeline.