ποΈ Quick Start
First install the module via yarn or npm and do not forget to install the database driver as well:
ποΈ Usage with NestJS
Installation
ποΈ Usage with Vanilla JS
Since MikroORM 3.2, we can use EntitySchema helper to define own entities without decorators, which works also for Vanilla JavaScript.
ποΈ Usage with Babel
When compiling TS via babel, decorators are by default handled different implementation than what tsc uses. To make the metadata extraction from decorators via Babel work, we need to do use following plugins:
ποΈ Usage with AdminJS
Installation
ποΈ Using Entity Constructors
Internally, MikroORM never calls entity constructor, so you are free to use it as you wish. The constructor will be called only when you instantiate the class yourself via new operator, so it is a handy place to require your data when creating new entity.
ποΈ Using Multiple Schemas
In MySQL and PostgreSQL it is possible to define your entities in multiple schemas. In MySQL terminology, it is called database, but from an implementation point of view, it is a schema.
ποΈ Using native BigInt PKs (MySQL and PostgreSQL)
We can use BigIntType to support bigints. By default, it will represent the value as a string.
ποΈ Using AsyncLocalStorage
In v4 and older versions, the domain api was used in the RequestContext helper. Since v4.0.3, we can use the new AsyncLocalStorage too, if we are on up-to-date node version:
ποΈ Creating Custom Driver
If you want to use database that is not currently supported, you can implement your own driver. To do so, you will need to design 4 classes: