MikroORM
Hierarchy
- MikroORM<PostgreSqlDriver>
- MikroORM
Index
Constructors
constructor
Parameters
options: Options<PostgreSqlDriver> | Configuration<PostgreSqlDriver>
Returns PostgreSqlMikroORM
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
close
Closes the database connection.
Parameters
force: boolean = false
Returns Promise<void>
connect
Connects to the database.
Returns Promise<PostgreSqlDriver>
discoverEntities
Returns Promise<void>
discoverEntity
Allows dynamically discovering new entity by reference, handy for testing schema diffing.
Parameters
entities: Constructor | Constructor[]
Returns Promise<void>
getEntityGenerator
Gets the EntityGenerator.
Type parameters
- T: IEntityGenerator = IEntityGenerator
Returns T
getMetadata
Gets the
MetadataStorage
.Returns MetadataStorage
getMigrator
Gets the Migrator.
Type parameters
- T: IMigrator = IMigrator
Returns T
getSchemaGenerator
Gets the SchemaGenerator.
Returns SchemaGenerator
getSeeder
Gets the SeedManager
Type parameters
- T: ISeedManager = ISeedManager
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
Initialize the ORM, load entity metadata, create EntityManager and connect to the database. If you omit the
options
parameter, your CLI config will be used.Type parameters
- D: IDatabaseDriver<Connection, D> = PostgreSqlDriver
Parameters
optionaloptions: Options<D> | Configuration<D>
connect: boolean = true
Returns Promise<MikroORM<D>>
Helper class for bootstrapping the MikroORM.