rootEntityProperties
rootEntityProperties(
columns?):object
Defined in: packages/ddd-mikro-orm/src/mapping/root-entity.properties.ts:36
Identity and timestamp columns shared by every RootEntity schema, mapped
through the entity’s private hydration setters (accessor: true). Timestamps
are stored as epoch milliseconds through UnixTimestampType. Returns
fresh property definitions for each schema.
Parameters
Section titled “Parameters”columns?
Section titled “columns?”RootEntityColumns = {}
Column names that differ from the defaults.
Returns
Section titled “Returns”object
createdAt
Section titled “createdAt”
readonlycreatedAt:object
createdAt.accessor
Section titled “createdAt.accessor”
readonlyaccessor:true=true
createdAt.fieldName
Section titled “createdAt.fieldName”
readonlyfieldName:string
createdAt.type
Section titled “createdAt.type”
readonlytype: typeofUnixTimestampType=UnixTimestampType
readonlyid:object
id.accessor
Section titled “id.accessor”
readonlyaccessor:true=true
id.fieldName
Section titled “id.fieldName”
readonlyfieldName:string
id.primary
Section titled “id.primary”
readonlyprimary:true=true
id.type
Section titled “id.type”
readonlytype:"string"='string'
updatedAt
Section titled “updatedAt”
readonlyupdatedAt:object
updatedAt.accessor
Section titled “updatedAt.accessor”
readonlyaccessor:true=true
updatedAt.fieldName
Section titled “updatedAt.fieldName”
readonlyfieldName:string
updatedAt.type
Section titled “updatedAt.type”
readonlytype: typeofUnixTimestampType=UnixTimestampType
Example
Section titled “Example”export const UserSchema = new EntitySchema<User, AggregateRoot>({ class: User as any, tableName: 'users', properties: { ...rootEntityProperties(), version: versionProperty(), email: { type: 'string', unique: true }, },});