chronos
chronos
DTDrizzle Team
Created by Pioter on 10/22/2023 in #help
Prepared Update statements
Did you ever manage to resolve this? I am having the same issue.
7 replies
DTDrizzle Team
Created by chronos on 1/11/2024 in #help
Can't save json via prepared statements
Seems like a github issue is open for the same. Added this comment there too https://github.com/drizzle-team/drizzle-orm/issues/1117
2 replies
DTDrizzle Team
Created by chronos on 1/11/2024 in #help
Correct way of handling upserts in MySql
Thank you so much this works perfectly!
5 replies
DTDrizzle Team
Created by chronos on 1/11/2024 in #help
Correct way of handling upserts in MySql
Oh cool, I seemed to have missed onDuplicateKeyUpdate. Ill try that and see. Thanks!
5 replies
DTDrizzle Team
Created by jakeleventhal on 12/24/2023 in #help
Question about handling upsert case
const updated = await db
.update(...)
.set(...)
.where(eq(..))

// If no rows updated, create new row
if (updated[0].affectedRows === 0) {
await db.insert(...).values(...)
}
const updated = await db
.update(...)
.set(...)
.where(eq(..))

// If no rows updated, create new row
if (updated[0].affectedRows === 0) {
await db.insert(...).values(...)
}
29 replies