hobby_codes
hobby_codes
DTDrizzle Team
Created by hobby_codes on 6/17/2023 in #help
Error updating a record
I'm getting an error typescript: Cannot find name 'buildings'. Did you mean 'buildingId'? [2552] when trying to update an item
import * as schema from "@/drizzle/schema"
import { PostgresJsDatabase, drizzle } from "drizzle-orm/postgres-js"
import postgres from "postgres"

const queryClient = postgres(process.env.DATABASE_URL ?? "", { max: 3 })
const db = drizzle(queryClient, { schema })

const updatedBuilding: { updatedBuildingId: number }[] = await db
.update(buildings)
.set({
buildingName,
buildingLocation,
country,
buildingComments,
})
.where(eq(buildings.buildingId, buildingId))
.returning({ updatedBuildingId: buildings.buildingId })
import * as schema from "@/drizzle/schema"
import { PostgresJsDatabase, drizzle } from "drizzle-orm/postgres-js"
import postgres from "postgres"

const queryClient = postgres(process.env.DATABASE_URL ?? "", { max: 3 })
const db = drizzle(queryClient, { schema })

const updatedBuilding: { updatedBuildingId: number }[] = await db
.update(buildings)
.set({
buildingName,
buildingLocation,
country,
buildingComments,
})
.where(eq(buildings.buildingId, buildingId))
.returning({ updatedBuildingId: buildings.buildingId })
I'm using nextjs13 app directory and this code is in a form action What could be the issue
5 replies