Skip to main content

Function: UpdatedAt()

UpdatedAt(columnName?): PropertyDecorator

Defined in: src/decorators/UpdatedAt.ts:14

Property decorator indicating that this field is auto-updated with current timestamp (new Date()) on INSERT and UPDATE.

Parameters​

ParameterTypeDescription
columnName?stringOptional custom database column name.

Returns​

PropertyDecorator

Usecase​

Automatically track when records were last modified in the database.

Example​

@UpdatedAt()
updatedAt!: Date;