prisma-engines icon indicating copy to clipboard operation
prisma-engines copied to clipboard

feat(qc): add support for SQL NOW() function

Open LinusU opened this issue 4 months ago • 4 comments

Opening this for some early feedback, my end goal is to be able to use the database timestamps when running UPDATE commands. I know that there is an issue for this on the Prisma issue tracker, but after searching for almost an hour I gave up trying to find it 😓 Searching for "now" gives a ton of results...

Our code is litered with $executeRaw with something like: UPDATE ... SET "deletedAt" = NOW() WHERE ....

My goal is to be able to replace this with something like:

import { Now } from '@prisma/client'

// ...

await prisma.foobar.update({
  where: ...
  data: { deletedAt: Now }
})

Any pointers and feedback greatly appreciated! 🙌

LinusU avatar Aug 27 '25 13:08 LinusU

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 27 '25 13:08 CLAassistant

Currently stuck on running the tests locally, and unfortunately don't have more time today, will pick up another day!

note to self: I've run . ./.envrc, make dev-postgres13, and are now trying to cargo test -p query-engine-tests

LinusU avatar Aug 27 '25 13:08 LinusU

@LinusU try make dev-pg-qc-query instead of make dev-postgres13 if you want to run tests with QC (assuming that's what you want to do based on the PR title). Otherwise, your sequence of steps is correct if you want to run tests with query engine.

aqrln avatar Aug 28 '25 13:08 aqrln

CodSpeed Performance Report

Merging #5606 will not alter performance

Comparing LinusU:lu-now (47de924) with main (85179d7)

Summary

✅ 11 untouched benchmarks

codspeed-hq[bot] avatar Aug 28 '25 13:08 codspeed-hq[bot]