yarn @mikro-orm/core 7.0.0
v7.0.0

latest releases: 7.0.1, 7.0.1-dev.4, 7.0.1-dev.3...
10 hours ago

7.0.0 (2026-03-11)

Release blogpost: https://mikro-orm.io/blog/mikro-orm-7-released
Upgrading guide: https://mikro-orm.io/docs/upgrading-v6-to-v7

Features

  • add JSR publishing support (#7253) (c93c92a)
  • change default loadStrategy to balanced (431f989)
  • cli: support various TS loaders (#6987) (3fe125c)
  • core: add $size collection operator (#7090) (e12051e)
  • core: add collation support and MongoDB query options (#7189) (e350aa1)
  • core: add EntityName symbol for decorator-based Kysely type inference (#7199) (0b78e36)
  • core: add EntitySchema.new helper to create entity instances (#7077) (64ad492)
  • core: add forceObject option to defineEntity (0a3df4d)
  • core: add populateHints option to FindOptions for per-relation populate overrides (#7198) (158e1cf)
  • core: add entity-level default orderBy option (#7133) (4bfa0e4)
  • core: add slow query logging support (#7271) (13b97f5), closes #4695
  • core: add support for polymorphic relations (#7121) (e9eb256)
  • core: add support for streaming (#6923) (88b0d5b)
  • core: add support for Table-Per-Type inheritance (#7137) (f6abee5)
  • core: add support for view entities (#7116) (7bfcb10)
  • core: add WHERE clause support to upsert via onConflictWhere option (#7117) (673c1bb)
  • core: allow reusing raw query fragments (#7058) (bcf8cb7)
  • core: execute transaction events on child transactions (0fc822f)
  • core: improve formula callback to provide more information about the table and column mapping (#7105) (9ee78d5)
  • core: improve type safety of various decorators (463eef6)
  • core: make em.assign typing stricter to catch typos (5c3aea1)
  • core: make em.create typing stricter to catch typos (39e8c30)
  • core: move file discovery to separate file (#6993) (d880412)
  • core: propagate persist stack in em.transactional fork (0c90e67)
  • core: support FKs pointing to non-PK columns via targetKey option (#7099) (f98541b)
  • core: support null values in cursor-based pagination (#7095) (b1fb67c)
  • core: support pre-compiled functions for eval-free runtimes (#7166) (d8b2c3e)
  • core: validate dangerous property names (#7089) (78e570d)
  • decorators: introduce @mikro-orm/decorators package with legacy and ES decorator definitions (#7011) (81e5e97)
  • defineEntity: allow extending generated class with custom methods (#7104) (25362b8)
  • entity-generator: add manyToManyPropertyName to NamingStrategy (#7130) (edf1c49)
  • kysely: add MikroKyselyPlugin to support various ORM features with kysely (#6998) (d01d93b)
  • migrations: remove umzug dependency, improve bundler support (#7203) (05f195f)
  • oracle: add Oracle DB driver (#6704) (ef140af)
  • postgres: add support for materialized views (#7119) (b68e774)
  • query-builder: add support for common table expressions (CTE) (#7231) (ebd0d43)
  • schema: add native support for advanced index features (#7160) (a2330d2)
  • schema: allow changing defaults for update/deleteRule and remove inference from cascade option (#7115) (dd6a226)
  • schema: allow skipping views (#7150) (be74bf9)
  • seeder: remove tinyglobby dependency, add seedersList option (#7206) (7f923e5)
  • sql: add $elemMatch operator for JSON array properties (#7265) (e40a275)
  • sql: improve QueryBuilder type safety with context-aware types (#7138) (631e351)
  • sql: infer Database for kysely (#6939) (8f8ada5)
  • sql: replace knex with kysely (#6400) (2a0384e)
  • sql: replace knex with native implementation of query and schema building (#6358) (c8471ca)
  • sql: strictly type SelectQueryBuilder.execute() return type (#7200) (1e15042)
  • sql: support aliasing formula and regular properties in QueryBuilder select (#7190) (6d8da38)
  • sql: support UNION-based where clauses as index-friendly alternative to $or (#7214) (1e8a674)
  • sql: transparent querying of embedded array properties (#7264) (c9f13bb), closes #1887
  • sqlite: add ATTACH DATABASE support for multiple database files (#7131) (27f9cac)
  • sqlite: enable down migrations (bd3bb56)
  • sqlite: simplify using other sqlite libraries like node:sqlite (#7204) (7e8da43)

Bug Fixes

  • core: allow using property accessor on to-one relations (621d10a), closes #7211
  • core: always check the database when querying by PK with filters (8bd62b2), closes #7084
  • core: do not convert custom types in em.refresh (3f8abdf), closes #7073
  • core: do not propagate cursor related options to populate queries (e667290), closes #7148
  • core: duplicate discovery of embeddables with defineEntity (#7125) (3d57516)
  • core: enable forceUtcTimezone by default for all SQL drivers (#7087) (c89890b), closes #5591
  • core: ensure populate hint won't include undefined for optional relations (ea6722c)
  • core: ensure column name conflicts in M:N are propagated to STI child entities (562515c), closes #7123
  • core: ensure no collisions in polymorphic embeddables with shadowed properties (25554b1)
  • core: ensure owning FK is selected for to-many inverse sides (cead90d)
  • core: fix applying filters on nested relation conditions (e828240)
  • core: fix double processing of JSON properties when reloading an entity (945e5cd)
  • core: fix enum arrays with defineEntity failing on metadata validation (0412fd3)
  • core: fix findOne with entity refs for composite PKs with shared FK columns (b8a39e2), closes #5629
  • core: fix processing filters on to-many relations (8b193aa)
  • core: fix result caching for custom types (10a4044), closes #7112
  • core: improve handling of deeply nested composite keys in em.create (28261a0), closes #6894
  • core: improve intellisense for partial loading in em.populate (384f432)
  • core: make entity prototype toJSON non-enumerable to prevent data leaks (013f57f)
  • core: map arrays inside object embeddables to JSON arrays by default (6835f72)
  • core: normalize populate option in Collection.matching() for M:N relations (#7091) (d9b996f)
  • core: only respect Hidden type on scalar properties (#7097) (36372a2), closes #7062
  • core: preserve embeddable properties in toPOJO regardless of partial loading hints (455be24)
  • core: preserve function expression indexes through metadata cache round-trip (#7228) (b7c002c)
  • core: prevent double JSON-encoding of nested embeddable arrays (ba22eba)
  • core: prevent property mutation during polymorphic embeddable discovery (#7270) (c3a5978), closes #6522
  • core: respect exclude hint in implicit serialization via toObject (#7259) (cd9e09f)
  • core: respect exclude option on eager properties (908e236)
  • core: respect orphanRemoval on 1:1 relations when inverse side is a PK (#7081) (960425c)
  • core: respect custom repositories with InferEntity (c5160ee)
  • core: respect EM schema when joining a wildcard entity from a static schema entity (69ca26c), closes #7082
  • core: respect explicit tableName when computing join table names (fe5e10f)
  • core: respect loaded hint for Ref relations inside array embeddables (27efe05)
  • core: support overlapping properties with different field names in STI (5d83d0f), closes #5813
  • core: support querying by all keys of discriminated union types (21b7a80), closes #7111
  • core: support schema parameter in formula query when using QB with partial loading (4820bb6)
  • core: support wildcard wrap(e).populate() hints on type level (a05e46c)
  • core: use full hydration in mergeData for initialized entities (32a0baa), closes #7205
  • core: use less strict repository option type to fix issues with defineEntity and cycles (7110dc3)
  • defineEntity: fix inference issues in hooks definition (d5e9f92)
  • entity-generator: strip schema prefix from FK property names (#7134) (173ff9b)
  • guard prototype.toJSON against being called on prototype itself (#7152) (0392156), closes #7151
  • migrations: delete snapshot file after migration:down (95e0d88)
  • migrations: normalize snapshots and write on both up/down (#7235) (511d8ad)
  • migrations: skip snapshot write on migration:up to support read-only filesystems (c5ebd0a)
  • migrations: support emitting multiline comments (#7186) (2fe61c8)
  • mongo: fix field name conversion when querying object embedded entities (a713819)
  • mongo: fix support for deno by handling TypedArray when cloning (#7258) (17ec4f5)
  • mongo: rework support for serialized primary keys (54ad3c5)
  • postgres: fix phantom diffs for complex check constraints (#7216) (b0fefd0)
  • postres: fix casting of object embedded relation properties (0e80f59)
  • query-builder: apply WHERE conditions to ORDER BY joins in paginated queries (128e58b), closes #6160
  • schema: disable FK checks by default only for orm.schema.clear() in MySQL (c0d942d)
  • schema: do not ignore changes to entity level comments (4087704), closes #7187
  • schema: do not infer nullability of to-one relations based on cascade option (56be7f3), closes #6972
  • sql: always alias virtual properties in where query (37f35af), closes #7196
  • sql: cross-schema JOINs no longer inherit main entity's schema (#7250) (07852fc)
  • sql: fix populating M:N relations with pivotEntity that uses mapToPk: true (cdd8f85), closes #7107
  • sql: handle $not operator inside relation filters (#7226) (b002e16)
  • sql: ignore missing tables during schema clear (8f90f07)
  • sql: qualify cross-schema FK references with dbName on MySQL/MariaDB (#7251) (489d2b9)
  • sql: skip pagination subquery and force balanced strategy for virtual entities (e2c1287), closes #7195
  • sti: ensure stable order in the generated discriminator map (b51d6fd), closes #6455

Performance Improvements

  • core: improve defineEntity type performance (#7202) (d7491a7)
  • core: improve InferEntity performance when extends is used (#7120) (f6640e8)
  • core: improve Loaded type performance by optimizing field selection (#7201) (a34269a)
  • core: improve inference via InferEntity type (#7108) (9f8f393)
  • core: optimize AutoPath and Loaded type instantiation costs (#7128) (6f7349d)
  • core: optimize em.assign typing (#7129) (9e84be3)
  • core: optimize type instantiation costs with structural shapes (#7132) (b6b0f0f)
  • core: rework auto-flush detection to rely on explicit em.persist calls (#6982) (e66f138)

Don't miss a new core release

NewReleases is sending notifications on new releases.