UUID Confusion with database orm
Hi I just recently switched from Prisma-orm to Drizzle-orm in the project that I am working on. Having a bit of issue where my user table doesn't seem to understand the uuid coming from my sign-up form. Curious to see if anyone knew exactly what I have done wrong?
Solution:Jump to solution
Yes this is completely fine. If you want the old way where your DB handles ID generation, you can disable Better-Auth's ID generation by passing
advanced.database.generateId
as false
in your auth config.3 Replies
My
auth.ts
file looks something like this.
The user schema looks like this
The error I am seeing in my console when trying to sign up a new user is this
I might have solved this myself. I am not sure if this is the correct way of doing it but I deleted my old schema.ts
file and ran the npx @better-auth/cli@latest generate
cli to get a new schema file. However this gives the id
field a text value so that we can pass the NanoID into the database. Is this secure/correct way of doing this?
Meaning my user
schema looks like this
Solution
Yes this is completely fine. If you want the old way where your DB handles ID generation, you can disable Better-Auth's ID generation by passing
advanced.database.generateId
as false
in your auth config.Which one is the recommended way?