MikroORM <Driver, EM, Entities>
Hierarchy
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Synchronous variant of the
initmethod with some limitations:- folder-based discovery not supported
- ORM extensions are not autoloaded
- when metadata cache is enabled,
FileCacheAdapterneeds to be explicitly set in the config
Parameters
options: Options<Driver, EM, Entities>
Returns MikroORM<Driver, EM, Entities>
Properties
readonlyconfig
readonlydriver
em
The global EntityManager instance. If you are using RequestContext helper, it will automatically pick the request specific context under the hood
Accessors
entityGenerator
Gets the EntityGenerator.
Returns IEntityGenerator
migrator
Gets the Migrator.
Returns IMigrator
schema
Gets the SchemaGenerator.
Returns ReturnType<ReturnType<Driver[getPlatform]>[getSchemaGenerator]>
seeder
Gets the SeedManager
Returns ISeedManager
Methods
checkConnection
Checks whether the database connection is active, returns the reason if not.
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<Driver>
discoverEntity
Allows dynamically discovering new entity by reference, handy for testing schema diffing.
Parameters
entities: T | T[]
optionalreset: EntityName | EntityName[]
Returns void
getMetadata
Gets the
MetadataStorage.Returns MetadataStorage
isConnected
Checks whether the database connection is active.
Returns Promise<boolean>
reconnect
Reconnects, possibly to a different database.
Parameters
options: Partial<Options<Driver, EM, Entities>> = {}
Returns Promise<void>
The main class used to configure and bootstrap the ORM.