A way to use the update function with existing value in row?

How do I do the following SQL UPDATE counts SET count = count + 1 WHERE id = 1 but with drizzle orm, such as await db.update(counts).set({ count: current_count + 1, }); is that even possible or is raw sql my only option?
2 Replies
Luxaritas
Luxaritas13mo ago
You probably want
await db.update(counts).set({
count: sql`${counts.count} + 1`,
});
await db.update(counts).set({
count: sql`${counts.count} + 1`,
});
Web Dev Cody
Web Dev CodyOP13mo ago
I'll try that
Want results from more Discord servers?
Add your server