How do I get insertId from table using cuid2

I want to insert data using a relations, but mysql doesn't support returning(). so i was using insertId, but it doesn't work with custom id like cuid. What should i do
5 Replies
404
404OP10mo ago
I did some research and I think this is the way the database works, there is no solution.
mattlehrer
mattlehrer10mo ago
Save it as a variable before the first insert?
404
404OP10mo ago
I don't know what you're trying to say. I want to get the auto generated cuid2 by drizzle of the column that I insert.
mattlehrer
mattlehrer10mo ago
cuid2 is running in your application, not in your database, right? So just run it before the first insert and save the output to a variable
404
404OP10mo ago
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Want results from more Discord servers?
Add your server