Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
How to write a good username schema? - Drizzle Team
DT
Drizzle Team
•
2y ago
•
5 replies
textYash
How to write a good username schema?
I am creating a users table with fields
, id
, username
, email
& password
. Why do I need to use the id field
? Why can
't I just use username as the primary key
? Would there be any drawbacks to that
?
If I use
primaryKey()
primaryKey()
then do I need
unique().notNull()
unique().notNull()
?
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Does anyone know how to write `::character varying` correctly in schema?
DT
Drizzle Team / help
2y ago
How do I write a trigger??
DT
Drizzle Team / help
3y ago
How to ignore a schema column for database
DT
Drizzle Team / help
2mo ago
How to check schema fields against a regex?
DT
Drizzle Team / help
2y ago