bennettcohen
bennettcohen
DTDrizzle Team
Created by bennettcohen on 7/17/2024 in #help
Connecting with SSL
No description
2 replies
DTDrizzle Team
Created by bennettcohen on 7/11/2024 in #help
Type safety on .set() method?
Hey folks - I was wondering if there is a way to get type safety when updating a row using the .set method? In the example below, updated_at is the table name, not the property name updatedAt. This code runs with no errors, but of course never updates the updated at because it doesn't exist!
const data = await db
.update(verifications)
.set({
status: 'inactive',
updated_at: sql`NOW()`,
})
.where(and(eq(sql`${persons.id}::text`, personId)))
.returning();
const data = await db
.update(verifications)
.set({
status: 'inactive',
updated_at: sql`NOW()`,
})
.where(and(eq(sql`${persons.id}::text`, personId)))
.returning();
Any tips for getting this to be type-safe ?
12 replies