Skip to content

Allow targeting specific fields for @updatedAt #593

@sanny-io

Description

@sanny-io

The @updatedAt attribute updates the timestamp when any change is made to a record. I propose adding a new fields parameter, which only updates the timestamp when any of the fields specified are changed.

Prisma issues: prisma/prisma#7602 prisma/prisma#12164

Sample Usage

model User {
  name String
  nameUpdatedAt DateTime @updatedAt(fields: [name])
}

I will start implementing this feature if and when #572 is merged, but these features would pretty much be mutually exclusive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions