Open motoi-dev opened 3 weeks ago
drizzle-orm
0.30.4
drizzle-kit
0.20.14
As the title, the update method returns the updated information even when a non-existent key is used to update a value. For example, the below result is [{ updatedUserId: 2 }], however, age column does not exist.
[{ updatedUserId: 2 }]
age
curl -X 'PATCH' \ 'http://localhost:8787/users/2' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{"age": 2}'
import type { User } from './schema' ... const app = new Hono() app.patch( '/users', async (c) => { const userId = c.req.param('id') const body = await c.req.json<User>() const result = await db .update(users) .set(body) .where(eq(users.id, Number(userId))) .returning({ updatedUserId: users.id }) console.log(result) return c.json({ ok }) } )
export const users = sqliteTable('users', { id: integer('id').primaryKey({ autoIncrement: true }), name: text('name').unique(), }) export type User = typeof users.$inferSelect
Non-existent column error occurs.
No response
What version of
drizzle-orm
are you using?0.30.4
What version of
drizzle-kit
are you using?0.20.14
Describe the Bug
As the title, the update method returns the updated information even when a non-existent key is used to update a value. For example, the below result is
[{ updatedUserId: 2 }]
, however,age
column does not exist.Expected behavior
Non-existent column error occurs.
Environment & setup
No response