What I have been trying to do is to generate and run migrations with typeorm in the nest.js app within Nx.dev Monorepo.
But cannot find a way to do so.
My mono-repo looks like this
My database configurations look like this database configurations
And this is how I have initialized my connection in the app.module.ts file
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
useClass: DatabaseConfig
}),
I just wanted to know the way to generate and up the migrations.
Thanks and regards
In order to run typeorm cli in my Nx monorepo, I have added following target in my
project.json
:where
cli.ts
returnsDataSourceOptions
in my command line configuration. Inside I have following configuration for migrations options:I execute it with following
package.json
script:In order to run migrations, I have added webpack configuration:
and configured my
build
target to use it with: