stoyko
stoyko
Explore posts from servers
DTDrizzle Team
Created by stoyko on 11/20/2023 in #help
Update number column with it's current value and new number
Do you think I can somehow get it working without using sql or will that not be possible
5 replies
DTDrizzle Team
Created by stoyko on 11/20/2023 in #help
Update number column with it's current value and new number
I was able to resolve this with the following query:
await ctx.db
.update(products)
.set({
quantity: sql`${products.quantity} + ${input.orderAmount}`,
})
.where(eq(products.id, productId));
await ctx.db
.update(products)
.set({
quantity: sql`${products.quantity} + ${input.orderAmount}`,
})
.where(eq(products.id, productId));
and it works great. I feel like I should be able to drop the string interpolation. But it works for now and that is fine for the moment.
5 replies