Skip to main content

Function: CreatedAt()

CreatedAt(columnName?): PropertyDecorator

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

Property decorator indicating that this field is auto-populated with the creation timestamp (new Date()) on INSERT.

Parameters​

ParameterTypeDescription
columnName?stringOptional custom database column name.

Returns​

PropertyDecorator

Usecase​

Automatically track when records are initially inserted into the database table.

Example​

@CreatedAt()
createdAt!: Date;