Skip to content

Commit 252744d

Browse files
authored
docs: clarify that forRoot() options are required since v7 (#254)
Closes #253
1 parent 38e1cba commit 252744d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,18 @@ export class AppModule {}
5555
```
5656

5757
The `forRoot()` method accepts the same configuration object as `init()` from the MikroORM package.
58-
You can also omit the parameter to use the CLI config.
58+
Since v7, the configuration must be provided explicitly — passing the options is required
59+
(see the [v6 to v7 upgrading guide](https://mikro-orm.io/docs/upgrading-v6-to-v7#mikroorminit-requires-options-parameter)).
60+
If you keep your config in a separate file (e.g. `mikro-orm.config.ts`), import it and pass it in:
61+
62+
```typescript
63+
import config from './mikro-orm.config';
64+
65+
@Module({
66+
imports: [MikroOrmModule.forRoot(config)],
67+
})
68+
export class AppModule {}
69+
```
5970

6071
Afterward, the `EntityManager` will be available to inject across entire project (without importing any module elsewhere).
6172

0 commit comments

Comments
 (0)