Nimish Gupta
06/30/2021, 11:27 AMPostgres
as DB)
model Test {
id String @id @default(uuid())
name String
// common fields
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@map("test")
}
and using below code snippet in node js.
async function update() {
// Node js
// Current state of the row in the DB
await model.test.findUnique({ where: { id: 1 } });
// { id: 1, name: "current_value", updated_at: "2021-06-30T11:00:16.291Z", created_at: "2021-06-30T11:00:16.291Z"}
await model.test.updateMany({ data: { name: "after_update" } });
// { id: 1, name: "after_update", updated_at: "2021-06-30T12:00:16.291Z", created_at: "2021-06-30T11:00:16.291Z"}
await model.$queryRaw(`UPDATE test set name = 'updater_after_raw'`); // @rawQuery
// { id: 1, name: "updater_after_raw", updated_at: "2021-06-30T12:00:16.291Z", created_at: "2021-06-30T11:00:16.291Z"}
}
Here after @rawQuery
, update_at
field is not being updated. Couldn't understand this behaviour. Is this intentional or any issue?
Expected behaviour - It should update the updated_at
field when I am writing raw update query in prisma.Ryan
06/30/2021, 11:37 AMRyan
06/30/2021, 11:48 AMNimish Gupta
06/30/2021, 11:50 AM{
"@prisma/client": "^2.26.0",
"prisma": "^2.26.0"
}
Nimish Gupta
06/30/2021, 11:52 AMRyan
06/30/2021, 11:52 AMupdatedAt
in the raw query for now. Not ideal but until this is fixed 😄Nimish Gupta
06/30/2021, 11:53 AM