TypeError: db.update(...).values is not a function

Hi Guys New here in drizzle. I'm using sveltekit, and i try to create somekind of update/edit form but i get this error TypeError: db.update(...).values is not a function
import type { Actions } from './$types.ts';
import * as schema from '$lib/schema.js';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { PUBLIC_DRIZZLE_DATABASE_URL } from '$env/static/public';
import { fail } from '@sveltejs/kit';

const sql = postgres(PUBLIC_DRIZZLE_DATABASE_URL!);
const db = drizzle(sql, { schema: schema });

export const actions: Actions = {
update: async ({ request }) => {
const body = Object.fromEntries(await request.formData());
console.log(body, 'testttt');
if (!body) {
return fail(400, {
error: 'Something went wrong'
})
}
await db.update(schema.property).values(body).where(eq(schema.property.id, body.id))
},
};
import type { Actions } from './$types.ts';
import * as schema from '$lib/schema.js';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { PUBLIC_DRIZZLE_DATABASE_URL } from '$env/static/public';
import { fail } from '@sveltejs/kit';

const sql = postgres(PUBLIC_DRIZZLE_DATABASE_URL!);
const db = drizzle(sql, { schema: schema });

export const actions: Actions = {
update: async ({ request }) => {
const body = Object.fromEntries(await request.formData());
console.log(body, 'testttt');
if (!body) {
return fail(400, {
error: 'Something went wrong'
})
}
await db.update(schema.property).values(body).where(eq(schema.property.id, body.id))
},
};
1 Reply
alka_99
alka_99OP10mo ago
sorry i just realized it, for update i should use .set instead of .value
Want results from more Discord servers?
Add your server