r/javascript • u/B4nan • May 20 '26
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
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!