Discussion: cuid2 vs ulid?

Is it better to have a sortable primayKey like ulid but leak the creation date? Or a non-sortable and slower one for enhanced security? Which is best for production apps? The section here in the docs references cuid2, but not ulid interestingly. https://orm.drizzle.team/docs/column-types/pg#constraints--defaults
5 Replies
Angelelz
Angelelz14mo ago
I use ulid all the time, I have a createId function helper that I pass to my id columns The fact that it's not mentioned doesn't mean you can't do it As for what's best, it's up to you, all the id types have pros and cons like everything
Paul
PaulOP14mo ago
Thanks for always replying!
Kai Revona
Kai Revona11mo ago
Can you @Angelelz give me the creatId ulid function
Angelelz
Angelelz11mo ago
This is what I use to create Ids https://github.com/ulid/javascript
GitHub
GitHub - ulid/javascript: Universally Unique Lexicographically Sort...
Universally Unique Lexicographically Sortable Identifier - GitHub - ulid/javascript: Universally Unique Lexicographically Sortable Identifier
Kai Revona
Kai Revona11mo ago
Thanks
Want results from more Discord servers?
Add your server