Automatically update a date field when a record is updated in Prisma

October 08, 2024

Using the attribute @updatedAt you can automatically update a data field every time a record is updated.

model MyModel {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}