Migration generator

This generator is responsible for generating TypeORM migration files by scanning the entities imported inside your service and converting them to SQL queries. In order for this generator to work, database connection environment variables inside the service folder should be valid.

You can the migration generator by executing the following command:

nx generate @microservice-stack/workspace:migration-generator

Executing the command will start the interactive shell which will guide you through the generator option. These options can also be added directly to the command by using the following flags:

  • --applicationName=<name> The name of the service you wish to generate migrations for

  • --dry-run This flag will run the generator without actually generating any files.

  • --no-interactive This flag will skip the interactive shell

If there are any migrations to be added, the generator will generate them inside the apps/api/service/migrations/ folder. It will also modify the apps/api/service/migrations.ts folder and include the newest migration into the array, which is the imported into the TypeORM module inside the app.module.ts file.

Last updated