Create a Lowercase constraint (or any custom constraint) in drizzle ORM schema
Emails should be case insensitive, so I achieve this by forcing lowercase. How do I do that in Drizzle?
22 Replies
You can add a uniqueIndex checking for unique email (compare by lowercase).
https://drizzle.run/kwwpxipbfaijyhccbnuryj9t
The best thing would be a check constraint but it is not yet supported
Drizzle Run
Unique with lower comparison - Drizzle Run
thank
man.
lol
I guess you have some protection that filter your browsing?
yes
i really dislike getting phished
:Haha:
Yeah It is because my public IP is shared with some 💩
so you host on some site?
and its true that Drizzle Run is new :p
vercel my beloved
Fly
I will buy a dedicated IP some day, depending on the price haha
in case you can't bypass
oh thanks bro
you the goat :thumbsup_nerd:
lemme hit ur site from search tho to boost ur seo
what keywords should i use
just drizzle run 😄
my seo is bad because of the loading screen (that load an editor and a virtual machine)
oh man this is very unfortunate
oh its not a blog post
that's why
a web app where you can play and share playgrounds made with Drizzle
very interesting
i like it
@Raphaël M (@rphlmr) ⚡ dyk if this schema automatically stores it as lowercase as well
or does it store it as whatever and compare unique in lowercase
silly customer writing [email protected] incoming
it store as it, if you want you can validate/transform the user input with Zod or Valibot
Drizzle ORM - drizzle-zod
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
if you know this package, it is easy to generate a Zod schema from your table definition and extends it to transform your payload
fire