Skip to content

Allow passing a field name to an updatedAt block  #12164

@jeremygottfried

Description

@jeremygottfried

Problem

I would like to be able track the update times of specific fields automatically, for example name_updated_at instead of just a blanket updated_at.

Suggested solution

I suggest offering the ability to pass a field name as an argument to the @updatedAt tag. For example:

model User {
  name String
  nameUpdatedAt DateTime @updatedAt(name)
}

Alternatives

Or if you want to make it a little more dynamic, then a list of field names like this

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

Additional context

field_updated_at is a fairly common sql pattern used extensively in rails. It makes it easier to track more sensitive changes, especially those that require authorization.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions