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
| Parameter | Type | Description |
|---|---|---|
columnName? | string | Optional custom database column name. |
Returns
PropertyDecorator
Usecase
Automatically track when records are initially inserted into the database table.
Example
@CreatedAt()
createdAt!: Date;