Skip to content

feat: combine mikroorm v6 & v7 implementation - #5

Merged
NaufalK25 merged 1 commit into
mainfrom
combine-mikroorm-v6-v7
Jul 31, 2026
Merged

feat: combine mikroorm v6 & v7 implementation#5
NaufalK25 merged 1 commit into
mainfrom
combine-mikroorm-v6-v7

Conversation

@NaufalK25

Copy link
Copy Markdown
Owner

Summary

  • Fixes a silent bug: MetadataStorage.getAll() returns a plain Dictionary in MikroORM v6 but a real Map in v7 — the adapter previously assumed the v6 shape (Object.values(...)), which under v7 quietly produced an empty diagram instead of erroring. Now branches on instanceof Map to handle both.
  • Adds MikroORM v7 test coverage (test/adapters/mikroorm-v7.test.ts + v7-basic/v7-composite fixtures using @mikro-orm/decorators) in a separate file/CI job from the v6 suite — mixing a v6-broken import into the same worker was observed to corrupt vitest's own error reporting for unrelated tests, not just fail the one that broke.
  • New mikroorm-v7 CI job installs @mikro-orm/core@7/@mikro-orm/sqlite@7/@mikro-orm/decorators@7 on top of npm ci (no --save) and runs just the mikroorm-scoped tests with coverage, uploaded to Codecov under its own mikroorm-v7 flag.
  • docs/adapters.md's MikroORM section updated to describe both versions and the one real behavioral difference above.

The committed @mikro-orm/core/@mikro-orm/sqlite devDependencies stay pinned to v6 (still what most existing production/NestJS codebases run) — v7 is exercised only via the dedicated CI job swapping the install on the fly, never touching package.json/package-lock.json. Both versions are targeted because the adapter always reads whatever MikroORM version the target project has installed, not orm2erd's own devDependency, so v6-only would silently misbehave for real v7 users and v7-only would break the still-larger v6 user base.

Test plan

  • npx vitest run test/adapters/mikroorm.test.ts test/detect/mikroorm.test.ts passes against the committed v6 devDependency
  • Manually swapped in @mikro-orm/core@7/@mikro-orm/sqlite@7/@mikro-orm/decorators@7 and confirmed test/adapters/mikroorm-v7.test.ts passes (skips cleanly under v6)
  • Full suite (npx vitest run) passes with v6 restored
  • npm run lint / npx prettier --check . clean

@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@NaufalK25
NaufalK25 merged commit 7c3dc31 into main Jul 31, 2026
2 checks passed
@NaufalK25 NaufalK25 added the enhancement New feature or request label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants