Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow passing an array of options into forRoot #203

Merged
merged 1 commit into from
Jan 28, 2025
Merged

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Jan 28, 2025

Since MikroORM v6.4, you can also define multiple configurations as part of a single ORM config. If you want to use such a combined config file, you need to destructure the result, since it will be also an array:

@Module({
  imports: [
    // `config` exports an array of configs
    ...MikroOrmModule.forRoot(config),
    MikroOrmModule.forMiddleware()
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

Closes #202

Since MikroORM v6.4, you can also define [multiple configurations](https://mikro-orm.io/docs/quick-start#configuration-file-structure) as part of a single ORM config. If you want to use such a combined config file, you need to destructure the result, since it will be also an array:

```typescript
@module({
  imports: [
    // `config` exports an array of configs
    ...MikroOrmModule.forRoot(config),
    MikroOrmModule.forMiddleware()
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
```

Closes #202
@B4nan B4nan merged commit 31ef0c8 into master Jan 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cant use mikro-orm's v6.4 feature of having multiple configs within mikro-orm.config.ts
1 participant