How to increment in drizzle?

logins: integer('logins').default(1).notNull(),
logins: integer('logins').default(1).notNull(),
await db
.update(users)
.set({ logins: sql`${users.logins} + 1` })
.where(eq(users.id, user.id));
await db
.update(users)
.set({ logins: sql`${users.logins} + 1` })
.where(eq(users.id, user.id));
ERROR: invalid input syntax for type integer: "[object Object]"
CONTEXT: unnamed portal parameter $1 = '...'
STATEMENT: update "User" set "logins" = $1 where "User"."id" = $2
ERROR: invalid input syntax for type integer: "[object Object]"
CONTEXT: unnamed portal parameter $1 = '...'
STATEMENT: update "User" set "logins" = $1 where "User"."id" = $2
This doesn't seem to work for me
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server