So I have a project which uses NestJS + TypeORM .
When i start the project in dev mode using yarn start:dev
before running any migration(DB is created at this point of time, but doesn't haveany tables), It creates all the tables automatically in DB apart from migrations table.
After that, if we try to run migration, it throws an error saying that table already exists which seems genuine.
So, why NestJS is automatically creating tables on yarn start:dev
?
Not sure how using yarn start:dev
can create tables automatically.
Both Synchronize and migrationsRun is false. AutoLoadentites is set to true
Hey try to setup synchronize
as false
.
.env
get parsed as string by default. Even though this.configService.get<boolean>
is used.
For ex.
createTypeOrmOptions(): TypeOrmModuleOptions {
return {
...
synchronize: this.configService.get<string>('TYPEORM_SYNCHRONIZE') === 'true' ? true : false,
...
};
}