
MikroORM 7.1: LazyRef, per-parent collection limiting, PGlite driver, query cancellation, database triggers, stored procedures, and more
MikroORM 7.1 is out — the first minor on top of v7, and it's a big one.
New features:
- LazyRef<T> — a new type-only relation flavor, no .$ / .get() indirection, TypeScript restricts access until Loaded<> narrows it
- PGlite driver — PostgreSQL running in WASM, no Docker, no separate server, works in the browser too
- Query cancellation via AbortSignal — per-call or fork-scoped, with cancel query / kill session strategies
- Database triggers — first-class schema management via @Trigger() / defineEntity
- Stored procedures and functions (experimental) — declare, diff, and call via em.callRoutine()
- PostgreSQL table partitioning — hash, list, and range, fully managed by the schema generator
- Server-side row cloning — em.clone() and qb.insertFrom() without round-tripping data through Node
- Runtime schema context for migrations — redirect migrations to a target schema at runtime, useful for multi-tenant setups
- em.countBy() for grouped counts
- Typed Kysely across DI-driven projects — new discovery:export CLI command generates a typed barrel for NestJS and similar setups
- getKysely() now binds to the active transaction
- fields whitelist in serialize()
- Type-safe index hints via using
- Partial indexes via where
Full blog post: https://mikro-orm.io/blog/mikro-orm-7-1-released
Changelog: https://github.com/mikro-orm/mikro-orm/releases/tag/v7.1.0
Happy to answer any questions!
u/B4nan — 1 day ago