You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An example app integrating Electron.js with Mikro-ORM. The Electron.js app is scaffolded using electron-vite.
MikroORM uses so called MetadataProvider to get necessary type information about our entities' properties. In this project we use TsMorphMetadataProvider as metadata provider, its process can be performance heavy and time-consuming. For this reason, metadata cache is automatically generated and stored inside ./temp folder to JSON files. 1
However, in Electron.js the app gets bundled using Vite into a single JavaScript file, therefore we need to deploy only the compiled output, without TS source files at all. In order to do that, we genrate cache bundle file which can be used together with GeneratedCacheAdapter.
In order to create new migrations you need to follow these steps:
How to create a new migration
Generate new metadata cache (This command will generate new metadata json file in the temp folder located in the project root)
yarn cache:generate
Generate a new migration
yarn migration:create
How to create initial migration
Remove existing migrations by deleting your migrations folder
Ensure you drop the existing database if it was previously created
Remove or comment out the import of metadata.json from mikro-orm-shared.config.ts if you haven't created your first metadata cache yet.