Skip to content

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

Merged
B4nan merged 1 commit intomasterfrom
for-root-array
Jan 28, 2025
Merged

feat: allow passing an array of options into forRoot#203
B4nan merged 1 commit intomasterfrom
for-root-array

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