insert multiple rows - onConflictDoUpdate

Hello, I am working on a project which is in prod now, I was originally looping through some data and inserting to my db in each iteration while having an onConflictDoUpdate for each one so that I can easily update data in said row. That has caused an issue with my db service which makes me think an insert multiple rows may be my best course of action. The only problem is that I don't know how to handle the onConflictDoUpdate because any of those rows can be conflicting and I'd like to update them if they are. Is there any way to do this? Thank you!
1 Reply
Sillvva
Sillvva4mo ago
This guide provides helpful info on how to upsert multiple rows. https://orm.drizzle.team/learn/guides/upsert
Drizzle ORM - Upsert Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Want results from more Discord servers?
Add your server