MikroORM <D, EM>
Hierarchy
Index
Constructors
constructor
Parameters
options: Options<D, EM> | Configuration<D, EM>
Returns MikroORM<D, EM>
Properties
readonlyconfig
em
The global EntityManager instance. If you are using RequestContext
helper, it will automatically pick the request specific context under the hood
Accessors
entityGenerator
Shortcut for
orm.getEntityGenerator()
Returns IEntityGenerator
migrator
Shortcut for
orm.getMigrator()
Returns IMigrator
schema
Shortcut for
orm.getSchemaGenerator()
Returns ReturnType<ReturnType<D[getPlatform]>[getSchemaGenerator]>
seeder
Shortcut for
orm.getSeeder()
Returns ISeedManager
Methods
checkConnection
Checks whether the database connection is active, returns .
Returns Promise<{ ok: true } | { error?: Error; ok: false; reason: string }>
close
Closes the database connection.
Parameters
force: boolean = false
Returns Promise<void>
connect
Connects to the database.
Returns Promise<D>
discoverEntities
Returns Promise<void>
discoverEntitiesSync
Returns void
discoverEntity
Allows dynamically discovering new entity by reference, handy for testing schema diffing.
Parameters
entities: T | T[]
optionalreset: string | string[]
Returns void
getEntityGenerator
Gets the EntityGenerator.
Returns T
getMetadata
Gets the
MetadataStorage
.Returns MetadataStorage
getMigrator
Gets the Migrator.
Returns T
getSchemaGenerator
Gets the SchemaGenerator.
Returns ReturnType<ReturnType<D[getPlatform]>[getSchemaGenerator]>
getSeeder
Gets the SeedManager
Returns T
isConnected
Checks whether the database connection is active.
Returns Promise<boolean>
reconnect
Reconnects, possibly to a different database.
Parameters
options: Options = {}
Returns Promise<void>
staticinit
staticinitSync
Synchronous variant of the
init
method with some limitations:- database connection will be established when you first interact with the database (or you can use
orm.connect()
explicitly) - no loading of the
config
file,options
parameter is mandatory - no support for folder based discovery
- no check for mismatched package versions
Parameters
options: Options<D, EM>
Returns MikroORM<D, EM>
- database connection will be established when you first interact with the database (or you can use
Helper class for bootstrapping the MikroORM.