Shezan
Shezan
DTDrizzle Team
Created by Shezan on 3/8/2024 in #help
Best/recommended column type for Id - Drizzle Neon
Hi everyone. I am using Drizzle, Next.js 14 app router & Neon serverless. Could anyone help me sharing the best column type for id field in a table? I think a solution that is auto generating, random, yet not very large (like UUID) is best. Most tutorials show a type of either text or serial. But text does not automatically set the Id, so I can't use insert without providing an id field. Serial is auto incrementing, but I read that such auto incrementing id is bad for security (ids being predictable). UUID is another option but they take up a lot of space & have some other downsides (https://dev.to/harshhhdev/uuidguid-cuid-nanoid-whats-the-difference-5dj1) . So which one should I use? I would love if you could share a short example with your answer. Thank you.
2 replies