Skip to content

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.

RootEntityColumns = {}

Column names that differ from the defaults.

object

readonly createdAt: object

readonly accessor: true = true

readonly fieldName: string

readonly type: typeof UnixTimestampType = UnixTimestampType

readonly id: object

readonly accessor: true = true

readonly fieldName: string

readonly primary: true = true

readonly type: "string" = 'string'

readonly updatedAt: object

readonly accessor: true = true

readonly fieldName: string

readonly type: typeof UnixTimestampType = UnixTimestampType

export const UserSchema = new EntitySchema<User, AggregateRoot>({
class: User as any,
tableName: 'users',
properties: {
...rootEntityProperties(),
version: versionProperty(),
email: { type: 'string', unique: true },
},
});