@mikro-orm/postgresql
7.2.11 · 20 Nov 2026MIT1.3M / weekRepositoryHomepagenpmAtom feed
6.6.19 is the newest release of 6.x.
In short
81 new3 faster30 fixed3 internal
Release note
mikro-orm.io/blog/mikro-orm-6-released
Bug Fixes
core: allow using classes with private constructor with
EntitySchemacore: collection.loadItems() should respect wildcard populate (7f3065f), closes #4977
core: do not load all env vars from
.envfiles automaticallycore: ensure correct serialization of not fully populated collections
core: ensure propagation and change-tracking works with
useDefineForClassFields(#4730) (83f24aa), closes #4216core: fix automatic calling of
ensureDatabaseoninitcore: fix hydration of complex FKs with joined strategy
core: fix hydration of object embeddables via joined strategy (b3e3e55), closes #5020
core: ignore SQL converter on object embeddables with custom types (83b989e), closes #5074
core: improve
EntitySchematyping forrepositoryoption (37ee42e), closes #5006core: make
em.createstrictly typed for relations too (#4752) (3535cc0), closes #4748core: make
Loadedtype more flexible (c95e3b6), closes #3277core: mark
Reference.set()as private (#5017) (5aebf0b), closes #5003core: refactor mapping of
Dateproperties (#4391) (3a80369), closes #4362 #4360 #1476core: respect
@Indexand@Uniquedecorators on embeddablescore: respect global
schemaoption in first level cachecore: respect schema option for entity instances in
em.insert/Many(7eae031), closes #4424core: return managed entity from
em.refresh()core: return managed entity from
em.refresh()core: rework
Collectioninitialization to useem.populate()(#4571) (7495142), closes #4464core: rework pivot table joining (#4438) (0506d36), closes #4423
core: support embedded properties with conflicting property names (b43ef63), closes #5065
core: use
join onconditions forpopulateWhere(#4025) (a03e57c), closes #3871entity-generator: use index expressions for complex indexes (e.g. conditional) (64a39f8), closes #4911
knex: respect connection type in
em.getKnex()mongo: don't rename
idto_idfor embeddables and entities without serialized PK (0cee82d), closes #4960postgres: allow postgres array operators on embedded array properties (ecf1f0c), closes #4930
postgres: parse timestamp dates less than year 100 (e774d40), closes #5071
Respect postgresql no timestamptz precision default
sql: do not alias conditions for update queries with collection operators (5820d66), closes #4956
sql: do not branch to-many joins for
$andwith a single item
Features
core: add
@EnsureRequestContextdecorator + rename@UseRequestContext(5e088ae), closes #4009core: add
Collection.load()methodcore: add
EagerPropssymbol to respect eager props on type levelcore: add
em.findAll()with optionalwhereoption (#4946) (23b0551), closes #3982core: add
FindOptions.excludecore: add
GeneratedCacheAdapterfor production usage (#4167) (bd478af), closes #4164core: add
Hiddentype as an alternative toHiddenPropssymbolcore: add
HiddenPropssymbol as type-level companion forhidden: true(7984769), closes #4093core: add
MikroORM.initSync()helper (#4166) (8b1a1fa), closes #4164core: add
Opttype as an alternative toOptionalPropssymbolcore: add
orm.checkConnection()helper (#4961) (b868f02), closes #4959core: add
ScalarRefandEntityReftypes to allow explicit control (1ef7856), closes #4907core: add
sql.now(),sql.lower()andsql.upper()functionscore: add
sql.ref()helpercore: add cursor-based pagination via
em.findByCursor()core: add customizable
LoggerContextwith labeling support (#4233) (b985646), closes #4230core: add discovery hooks
onMetadataandafterDiscoveredcore: add entity to identity map on
em.persist()(1b09d26), closes #4905core: add global
serialization.forceObjectoption (731087d), closes #4881core: add optional
Type.compareValuesmethod to allow custom comparators (732307a), closes #4870core: add support for indexes on JSON properties (#4735) (82c8629), closes #1230
core: allow all
CountOptionsinCollection.loadCount()core: allow auto-discovery of base classes with
EntitySchemacore: allow class references in
subscribersarray (7c8f776), closes #4231core: allow configuring filters in
Reference.load()andCollection.load()(#5025) (06012f7), closes #4975core: allow defining
serialization.forceObject: trueon type levelcore: allow disabling colors via
colorsORM config option (1bcaf09), closes #5037core: allow extending
EntityManagercore: allow inferring populate hint from filter via
populate: ['$infer'](#4939) (080fdbb), closes #1309core: allow M:1 and 1:1 relations in virtual entities
core: allow mapping database defaults from inline embeddables (#4384) (22ad61e), closes #3887
core: allow overriding global logging options on per-query basis (#4273) (51b6250), closes #4223
core: allow overriding ORM config path via
--configcore: allow passing string values for
PopulateHintenum (populateWhere)core: allow populating collections with references (#4776) (3da6c39), closes #1158
core: allow setting logger context on EM level (#5023) (7e56104), closes #5022
core: allow type-safe populate all via
populate: ['*'](#4927) (7780f34), closes #4920core: allow using
Refwrapper on scalar propertiescore: allow using dataloader for references and collections (#4321) (8f4790f), closes #266
core: allow using string values for
loadStrategyandflushModecore: auto-join M:1 and 1:1 relations with filters (#5063) (66a6b75), closes #4975
core: improve validation of bidirectional 1:1 relations
core: infer property type from default value (#4150) (38be986), closes #4060
core: make
em.insert/Manystrictly typed (require all properties)core: native
BigIntsupportcore: re-export the core package from all drivers
core: remove static require calls (#3814) (b58f476), closes #3743
core: require
mappedByoption for 1:m propertiescore: require explicitly marked raw queries via
raw()helpercore: respect
ignoreFieldson type level inwrap().toObject()(15de7a0), closes #4198core: respect
schemaparameter inclientUrl(#4998) (9176ee0), closes #4997core: respect naming strategy and explicit field names on embedded properties (#4866) (6151f3b), closes #4371 #2165 #2361
core: respect updates to M:N inverse sides and batch them (#4798) (ec65001), closes #4564
core: return
Loadedtype fromRef.load()(bc3ffa9), closes #3755core: return single entity from
em.populate()when called on single entitycore: rework serialization rules to always respect populate hint (#4203) (32d7c5f), closes #4138 #4199
core: strict partial loading (#4092) (d5d8c2d), closes #3443
core: support atomic updates via
raw()helper (#4094) (1cd0d1e), closes #3657core: support mapping one column to different STI properties (#4769) (e8d391b), closes #2388 #4440
core: throw when trying to iterate on a not initialized collection (2a3fd27), closes #3750
core: validate abstract target in relation decorators
core: validate duplicate field names (#4968) (71fead4), closes #4359
core: validate missing relation decorator (af31b3b), closes #3807
entity-generator: added ability to output type option in decorator
entity-generator: allow generating scalar properties for FKs (#4892) (abad6ca), closes #4898
entity-generator: allow local and global configuration of all options
entity-generator: allow overriding generated entity file name (4ebc8e3), closes #5026
entity-generator: detect more ManyToMany relations
entity-generator: generate
OptionalPropsand other symbols forEntitySchemamysql: support
order by nulls first/last(#5021) (df75b24), closes #5004postgres: add support for native enums (#4296) (8515380), closes #2764
postgres: add support for weighted tsvectors and a custom regconfig (#3805) (a0e2c7f), closes #3317
query-builder: add support for lateral sub-query joins (99f87c4), closes #624
query-builder: allow joining sub-queries (#4747) (613332c), closes #4429 #4549
query-builder: respect discriminator column when joining STI relation (57b7094), closes #4351
query-builder: support virtual entities (27f0c83), closes #5069
schema: add options to
schema.ensureDatabase()method to create/clearsql: add native support for generated columns
sql: print number of affected rows for insert and update queries
sql: rework joined strategy to support the default
populateWhere: 'all'sql: support
$some,$noneand$everysubquery operators (#4917) (50d2265), closes #2916sql: use joined strategy as default for SQL drivers
sql: use returning statements for reloading version fields on update
Performance Improvements
core: cache if entity has event listeners
core: optimize handling of FK value propagation
core: speed up detection of constructor/toJSON parameters during discovery
Breaking changes
Please see the upgrading guide.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.