Skip to main content
Version: Next

MikroORM <D, EM>

Helper class for bootstrapping the MikroORM.

Hierarchy

Index

Constructors

constructor

Properties

readonlyconfig

em

em: EM

The global EntityManager instance. If you are using RequestContext helper, it will automatically pick the request specific context under the hood

Accessors

entityGenerator

migrator

  • Shortcut for orm.getMigrator()


    Returns IMigrator

schema

  • get schema(): ReturnType<ReturnType<D[getPlatform]>[getSchemaGenerator]>
  • Shortcut for orm.getSchemaGenerator()


    Returns ReturnType<ReturnType<D[getPlatform]>[getSchemaGenerator]>

seeder

Methods

checkConnection

  • checkConnection(): Promise<{ error?: Error; ok: boolean; reason?: string }>
  • Checks whether the database connection is active, returns .


    Returns Promise<{ error?: Error; ok: boolean; reason?: string }>

close

  • close(force?: boolean): Promise<void>
  • Closes the database connection.


    Parameters

    • force: boolean = false

    Returns Promise<void>

connect

  • connect(): Promise<D>
  • Connects to the database.


    Returns Promise<D>

discoverEntities

  • discoverEntities(): Promise<void>
  • Returns Promise<void>

discoverEntitiesSync

  • discoverEntitiesSync(): void
  • Returns void

discoverEntity

  • Allows dynamically discovering new entity by reference, handy for testing schema diffing.


    Parameters

    Returns void

getEntityGenerator

  • getEntityGenerator<T>(): T

getMetadata

getMigrator

  • getMigrator<T>(): T

getSchemaGenerator

  • getSchemaGenerator(): ReturnType<ReturnType<D[getPlatform]>[getSchemaGenerator]>
  • Gets the SchemaGenerator.


    Returns ReturnType<ReturnType<D[getPlatform]>[getSchemaGenerator]>

getSeeder

  • getSeeder<T>(): T

isConnected

  • isConnected(): Promise<boolean>
  • Checks whether the database connection is active.


    Returns Promise<boolean>

reconnect

  • reconnect(options?: Options): Promise<void>
  • Reconnects, possibly to a different database.


    Parameters

    Returns Promise<void>

staticinit

staticinitSync