Skip to content

Comments

feat: support MikroORM v6#153

Merged
B4nan merged 14 commits intomikro-orm:masterfrom
ssut:chore/mikro-orm-v6
May 19, 2024
Merged

feat: support MikroORM v6#153
B4nan merged 14 commits intomikro-orm:masterfrom
ssut:chore/mikro-orm-v6

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)

@ssut ssut changed the title chore(deps): add support for mikro-orm v6 chore(deps)!: support for mikro-orm v6 Jan 8, 2024
@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
@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
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.

3 participants