TypeOrmModule.forRoot() should accept connection name
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
TypeOrmModule.forRoot('default')
is throwing as invalid code even though in the documentation states that it accepts the same arguments as createConnection()
does in Typeorm.
[{
"name": "default",
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "",
"password": "",
"database": "",
"entities": ["src/**/**.entity{.ts,.js}"],
"synchronize": false,
"migrationsTableName": "migrations",
"migrations": ["src/database/migrations/*{.ts,.js}"],
"cli": {
"migrationsDir": "src/database/migrations"
}
}, {
"name": "seed",
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "",
"password": "",
"database": "",
"entities": ["src/**/**.entity{.ts,.js}"],
"synchronize": false,
"migrationsTableName": "seeds",
"migrations": ["src/database/seeds/*{.ts,.js}"],
"cli": {
"migrationsDir": "src/database/seeds"
}
}]
Expected behavior
It should pick the connection name from your ormconfig.js or json file like Typeorm does.
What is the motivation / use case for changing the behavior?
To stay up to date with Typeorm’s codebase.
Environment
Nest version: 5.7.3
For Tooling issues:
- Node version: 10.5.0
- Platform: Mac
Issue Analytics
- State:
- Created 5 years ago
- Reactions:28
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Nestjs - Typeorm custom connection name - Stack Overflow
forRootAsync For TypeOrmModule.forRoot if works! Is there any different way to indicate the connection name? I need to add another connection ...
Read more >Database | NestJS - A progressive Node.js framework
To begin using the User entity, we need to let TypeORM know about it by inserting it into the entities array in the...
Read more >NestJS Multiple DB Setup with TypeORM - Level Up Coding
Following NestJS docs we will find the connection options example credentials directly set on code. ... @Module({ imports: [ TypeOrmModule.forRoot({
Read more >Getting started with continuous integration for Nest.js APIs
Configuring and connecting Nest.js to the database ... export class CreateProductDTO { @IsString() name: string; @IsString() description: ...
Read more >Multiple Databases | Nestjs-query - Blog
forRoot (environment), TypeOrmModule.forRoot({ // name: MUSIC_DB_CONNECTION, // if you leave this out, this will be the "default" connection! type: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1 for connection name support
Any update here? I’m seeing some oddities around this too.