Is there a special method where i tell the Prisma Client i want the field to be updated with the current database time ?
✅ 1
i
Irek Prucnal
08/10/2022, 11:43 AM
you can do something like this in your schema.prisma:
Copy code
createdAt DateTime @default(now())
Irek Prucnal
08/10/2022, 11:44 AM
or you can use it in a raw query if you need that on query level
n
Nurul
08/10/2022, 1:07 PM
Hey Adam 👋
As Irek mentioned it seems you need to use now which would set the value of current database time to the field.
d
Dave Edelhart
08/11/2022, 5:06 PM
worst case scenario if you need to use in an update scenario, you could
1. create a “dummy” table for getting now
2. create a new record in it
3. get the default createdAt value
4. insert that value into any new/updated records date field(s)