Here is the config:
@Module({
imports: [
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
type: 'postgres',
host: configService.get('DB_HOST'),
port: configService.get('DB_PORT'),
username: configService.get('DB_USER'),
password: configService.get('DB_PASSWORD'),
database: configService.get('DB_NAME'),
entities: [
__dirname + '/../**/*.entity{.ts,.js}',
],
// synchronize: true,
})
}),
],
})
export class DatabaseModule {}
The connections with the database itself is working, but when I'm trying to set up the migrations it throws the errors. What I've tried is to add the migration options in the above config and to create additional ormconfig.js with the configurations. Here is what I have in package.json file:
"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js"
The problem is when I try to create migration it is not being created in migrations folder as I want and is not using the config above, how to solve it?
DatabaseModule, right?