-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Cant use mikro-orm's v6.4 feature of having multiple configs within mikro-orm.config.ts #202
Comments
I don't think it can work the way you do it. But I guess we could expand the calls automatically if we see it's an array. Thoughts @boenrobot? |
that explains it. what is nice about mikro-orm supporting multiple configs in a single config file is that it plays well with the rest of their ecosystem. even in nestjs, in my MikroOrmModule.forRoot() and 'nestjs just magically works' with multiple configs. then i select which context in my services. |
Hmm, I guess we would still need a bit different approach, since |
ah i see. |
I guess we can have two signatures and users would just need to restructure the return value. |
Describe the bug
Mikro-orm v6.4 has a new feature where you can define multiple configs within mikro-orm.config.ts and then reference each one using
contextName
.This enables great synergy with their cli tool so that you can reference which context you want to use in a single config file (something like this:
npx mikro-orm --contextName=super
).When I try to set this up following their example, i get an error:
error: No driver specified, please fill in the `driver` option or use `defineConfig` helper (to define your ORM config) or `MikroORM` class (to call the `init` method) exported from the driver package (e.g. `import { defineConfig } from '@mikro-orm/mysql'; export defineConfig({ ... })`).
This problem is forcing me to have a multi config setup (aka something like
mikro-orm.super.config.ts
andmikro-orm.mini.config.ts
) and makes setting up the cli less dev friendly.To Reproduce
Steps to reproduce the behavior:
in
mikro-orm.config.ts
In
app.module.ts
In
some.service.ts
When I try to run my app, I get the error I posted above.
Expected behavior
Be able to have all my configs in a single file.
let me know if you cant reproduce this issue and it is an issue on my end. thanks!
The text was updated successfully, but these errors were encountered: