Reputation: 115
I've created basic app in Nestjs and tried to setup a TypeORM but even if I have turned on autoLoadEntities or entities: ['dist/**/*.entity.js'] TypeORM is not synchronizing my database. My app.module looks like:
@Module({
imports: [
TypeOrmModule.forRoot({
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'postgres',
password: 'root',
database: 'marketplace',
entities: ['dist/**/*.entity.js'],
synchronize: true,
}),
UserModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
and directory structure is:
I saw few tutorials and they was using same config as me and same directory structure and after using npm run start:dev typeorm was creating tables in their database. Could you help me?
Upvotes: 1
Views: 2196
Reputation: 115
I found a problem on github: https://github.com/typeorm/typeorm/issues/9766 The problem is with typeorm version 0.3.12. All I had to do is change typeorm version to 0.3.11 and wait to fix a bug. This problem occurs only on windows.
Upvotes: 1