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
PostgreSQL column types - DrizzleORM
Drizzle ORM | %s
5 Replies
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
Thanks for always replying!
Can you @Angelelz give me the creatId ulid function
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
Thanks