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: support MikroORM v6 #153

Merged
merged 14 commits into from
May 19, 2024
Merged

feat: support MikroORM v6 #153

merged 14 commits into from
May 19, 2024

Conversation

ssut
Copy link
Contributor

@ssut ssut commented Jan 8, 2024

BREAKING CHANGE:

MikroORM v6 and Nest.js v10 are now required. Also Node.js 18.12 is required.

Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, v6 is already supported, there are no required changes here, the peer dependency range should already allow stable v6 too (works fine with the realworld example)

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@ssut ssut changed the title chore(deps): add support for mikro-orm v6 chore(deps)!: support for mikro-orm v6 Jan 8, 2024
src/mikro-orm.middleware.ts Outdated Show resolved Hide resolved
@B4nan B4nan changed the title chore(deps)!: support for mikro-orm v6 feat: support MikroORM v6 Jan 8, 2024
@ssut ssut requested a review from B4nan January 8, 2024 12:42
src/mikro-orm.providers.ts Outdated Show resolved Hide resolved
@B4nan
Copy link
Member

B4nan commented Jan 9, 2024

Note for myself so I don't forget, we also need to rename the injection tokens for repositories (#106) for v6.

@tsangste
Copy link
Contributor

tsangste commented Mar 21, 2024

something that needs to be considered for this PR is that MikroORM via the re-export changes could be no longer viable as a DI token due to it potentially being another type e.g. MikroORM export from @mikro-orm/postgresql is actually PostgreSqlMikroORM.

import { MikroORM } from '@mikro-orm/postgresql'

@Injectable()
export class TestService {
  constructor(private readonly orm: MikroORM) {}
}

It would fail with the error Please make sure that the argument PostgreSqlMikroORM at index [0] is available in the RootTestModule context.

You can work around this via one of the following:

  1. Keep MikroORM type import from @mikro-orm/core
  2. Give MikroORM a context name and use @InjectMikroORM() decorator for injection

@B4nan B4nan merged commit a3ad8d6 into mikro-orm:master May 19, 2024
2 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.

None yet

3 participants