What problem does it solve?
Upgrading MikroORM from v6 to v7 breaks existing module code through removed APIs like persistAndFlush, relocated decorator imports, and the replacement of Knex with Kysely, producing type errors and runtime failures that are tedious to fix manually.
Core Features & Use Cases
- API Migration: Replaces persistAndFlush/removeAndFlush with the chained persist().flush() pattern and updates test mocks accordingly.
- Knex to Kysely Conversion: Rewrites raw SQL queries, inserts, updates, deletes, and JSONB casts using the Kysely query builder with sql template literals.
- Type and Config Fixes: Resolves FilterQuery and RequiredEntityData generic errors, moves decorator imports to @mikro-orm/decorators/legacy, and configures ReflectMetadataProvider.
- Use Case: A developer upgrades their Open Mercato module to MikroORM v7 and needs to convert all entity decorators, raw Knex queries, and Jest mocks while keeping migrations and snapshots consistent.
Quick Start
Migrate my module in apps/mercato/src/modules to MikroORM v7 and fix all resulting type errors.