Skip to main content
Version: Next

Changelog

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

6.2.3 (2024-04-24)

Bug Fixes

  • core: ignore upsert with inlined embedded properties (7d2bed6), closes #5500
  • query-builder: do not prune join branches when paginating and there are raw fragments in select clause (4d0fe15), closes #5490

6.2.2 (2024-04-20)

Bug Fixes

  • postgres: support wildcard native enums (e183de3), closes #5456

Features

  • query-builder: allow returning promise from virtual entity expression (ee98412), closes #5475

6.2.1 (2024-04-12)

Bug Fixes

  • core: skip 1:1 owner auto-joins for lazy properties (6442e57)
  • knex: rework postgres and mysql dialect imports to fix compilation errors (ffdca15)
  • query-builder: do not ignore unmatching partial loading hints in qb.joinAndSelect (ccdf018), closes #5445
  • query-builder: fix partial loading via qb.joinAndSelect with explicit aliasing (da68503), closes #5445
  • query-builder: generate join on condition for subquery joins with known property name (3dfbbde), closes #5445
  • query-builder: respect collection property where conditions (declarative partial loading) (3b4fc41), closes #5445

6.2.0 (2024-04-09)

Bug Fixes

  • core: do not select 1:1 owning FK twice (fa69276)
  • core: fix querying by embedded properties inside relations (2e74699), closes #5391
  • core: fix TypeError when ordering by embedded populating properties (2c472ab), closes #5389
  • entity-generator: allow arbitrary class and prop names as identifiers (#5359) (b0c0236)
  • mariadb: rework pagination mechanism to fix extra results (a57cb19)
  • mysql: support order by nulls first/last for raw query fragments in order by keys (a2a8f0d)
  • postgres: drop text enum check constraints only when necessary (#5414) (5162345), closes #4112
  • postgres: removed erroneous duplicates in FK discovery query (#5376) (eec2b38)
  • query-builder: fix serialization hint of nested qb.joinAndSelect() calls (c2843b9)
  • schema: improve detection of renamed columns (4d13c58)
  • schema: rework dropping columns to support custom schemas and merge drop column queries (255f425)

Features

  • core: allow configuring driverOptions on replica level (05e81f8)
  • libsql: add libSQL driver (#5417) (6c63e4b), closes #5283
  • mssql: add MS SQL Server driver (#1375) (eeaad45), closes #771
  • postgres: allow defining deferred FK constraints (#5384) (f42d171), closes #5306
  • query-builder: add limit 1 when executing query via getSingleResult() or execute('get') (c2b22e8), closes #5379
  • query-builder: add qb.getLoggerContext() and qb.setLoggerContext() (779fa15), closes #5358
  • schema: improve orm.schema.execute() to support executing batches (3c5a347)
  • schema: support recreating the whole database via orm.schema.refreshDatabase() (2e4ab49)

Performance Improvements

  • query-builder: remove unnecessary join branches when pagination is applied (d228976)

6.1.12 (2024-03-24)

Bug Fixes

  • core: fix inlining of $and conditions (8ddb3e4), closes #5368
  • entity-generator: try to resolve errors for foreign keys without indexes (f2094ab), closes #5364

Performance Improvements

  • postgres: try to optimize loading of foreign keys (2dff96b), closes #5364

6.1.11 (2024-03-18)

Bug Fixes

  • core: improve serialization of lazily partially loaded entities (1c7b446), closes #5139
  • query-builder: fix aliasing of FK when used in deeply nested and/or conditions (ebb966c), closes #5086
  • sql: fix aliasing of nested composite FK queries (60b2c91)

6.1.10 (2024-03-14)

Bug Fixes

  • core: don't alias formulas in update/delete queries (9e35642), closes #5334
  • core: fix populating references for 1:m collections (9b9027d), closes #5336
  • postgres: fix diffing of native enums (create/remove via schema:update) (7c8be79), closes #5322
  • query-builder: allow joining object/array properties (fd90bae), closes #5325
  • query-builder: fix join on conditions where or operator (92936ef)
  • schema: support compound index over JSON property and a regular column (319df49), closes #5333
  • sql: allow creating query builder from a global context (9217bb3)
  • sql: override FK value when it's disallowed by query condition (0d20847)

6.1.9 (2024-03-10)

Features

  • postgres: add support for native enum arrays (c2e362b), closes #5322

6.1.8 (2024-03-06)

Bug Fixes

  • core: fix bulk-inserting entities with nullable embedded arrays (f16551e)
  • query-builder: fix qb.getResultAndCount() when pagination is triggered (67444c0)

6.1.7 (2024-03-04)

Bug Fixes

  • core: fix aliasing of queries with collection operators (0435faf), closes #5301
  • core: ignore collection operators in populateWhere conditions (7b6b363)
  • query-builder: check for duplicate selects when wrapping pagination query (e005cc2)
  • query-builder: fix cloning of alias map (50d8fb9)

Features

  • core: validate wrong placement of collection operators (c35e705)

6.1.6 (2024-02-28)

Bug Fixes

  • core: support raw fragments in orderBy of 1:m and m:n relations (ed80163), closes #5277

6.1.5 (2024-02-21)

Bug Fixes

  • core: fix orderBy option on to-many properties with arrays (fae2302), closes #5265
  • core: ignore virtual properties in partial loading hint (d327db5), closes #5261
  • entity-generator: fixed generation of unsigned columns (#5254) (d78da29)
  • entity-generator: optional and hidden properties get type option + string defaults (#5264) (12d3b54), closes #5260
  • schema: allow 1:m properties in pivot entities (c370578)

6.1.4 (2024-02-16)

Bug Fixes

  • query-builder: fix caching of raw query fragments when qb.getQuery() is called (f79a752), closes #5247

Features

  • entity-generator: added support for generated columns (#5250) (d2186da)

6.1.3 (2024-02-13)

Features

  • entity-generator: support mapToPk option (#5241) (3afaa29)

6.1.2 (2024-02-11)

Note: Version bump only for package @mikro-orm/knex

6.1.1 (2024-02-10)

Bug Fixes

  • reflection: only validate known types to allow using type aliases (d6b93be), closes #5221

6.1.0 (2024-02-04)

Bug Fixes

  • core: handle possible match between virtual property name and another property's field name (7fc779f), closes #5191
  • postgres: improve diffing of native postgres enums (49d6b4d), closes #5108
  • query-builder: support convertToJSValueSQL on returning statement of update queries (2e1d6c8), closes #5176

Features

  • core: allow declarative partial loading of collection items (#5210) (5e4fa60), closes #4963
  • knex: add loggerContext parameter to em.execute (b6d46df)

6.0.7 (2024-01-30)

Features

  • postgres: add support for interval type (659a613), closes #5181

6.0.6 (2024-01-29)

Bug Fixes

  • query-builder: only map the first result with qb.getSingleResult() (0e56fe1), closes #5182

6.0.5 (2024-01-18)

Bug Fixes

  • query-builder: cache knex QB instance to get around issues with raw fragments (f6e76d8)

6.0.4 (2024-01-15)

Note: Version bump only for package @mikro-orm/knex

6.0.3 (2024-01-13)

Bug Fixes

  • core: allow raw fragments as keys with multiple conditions (d0d5de8), closes #5112
  • core: fix leaking raw fragments cache (9638410)
  • core: respect raw fragments in orderBy and populateOrderBy (7bf986c), closes #5110
  • core: support raw fragments in order by with pagination (67ee6f5), closes #5110

6.0.2 (2024-01-09)

Bug Fixes

  • core: respect logging options in em.count (481d02e), closes #5085
  • core: support $some/$none/$every on nested relations (2b3bd4d), closes #5099

Features

  • entity-generator: allow customizing entity name based on schema name (1e5afb8), closes #5084

6.0.1 (2024-01-08)

Note: Version bump only for package @mikro-orm/knex

6.0.0 (2024-01-08)

Bug Fixes

  • core: ensure propagation and change-tracking works with useDefineForClassFields (#4730) (83f24aa), closes #4216
  • core: fix automatic calling of ensureDatabase on init (827b1f1)
  • core: fix extra updates for composite FKs that share a column (5897514)
  • core: fix hydration of complex FKs with joined strategy (a4f30ac)
  • 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: refactor mapping of Date properties (#4391) (3a80369), closes #4362 #4360 #1476
  • core: respect context in virtual entity expression callback (94e4322)
  • core: return DriverException from em.upsertMany() (615f223), closes #4897
  • core: rework Collection initialization to use em.populate() (#4571) (7495142), closes #4464
  • core: rework pivot table joining (#4438) (0506d36), closes #4423
  • core: support composite PKs in em.upsertMany() (0ba5b6e), closes #4923
  • entity-generator: use index expressions for complex indexes (e.g. conditional) (64a39f8), closes #4911
  • knex: respect connection type in em.getKnex() (46957ba)
  • mysql: improve diffing of defaults for JSON columns (53c3911), closes #4926
  • postgres: allow postgres array operators on embedded array properties (ecf1f0c), closes #4930
  • postgres: allow using array operators (e.g. @>) with object arrays (ca8795a), closes #4973
  • postgres: respect column length in down migrations (d49d13c), closes #5048
  • schema: do not inherit schema for FKs if not a wildcard entity (aa2e889), closes #4918
  • schema: improve json default diffing for down migrations (cccc756)
  • schema: respect explicit schema in FKs to STI entities (22e7470), closes #4933
  • schema: respect up migration when detecting column renaming in down migration (ff50836), closes #4919
  • sql: deduplicate keys in batch update queries (1dbf8de)
  • sql: do not alias conditions for update queries with collection operators (5820d66), closes #4956
  • sql: do not branch to-many joins for $and with a single item (a737b20)

Features

  • core: add FindOptions.exclude (#5024) (fe239cf)
  • core: add MikroORM.initSync() helper (#4166) (8b1a1fa), closes #4164
  • core: add orm.checkConnection() helper (#4961) (b868f02), closes #4959
  • core: add sql.now(), sql.lower() and sql.upper() functions (#5044) (016fe63)
  • core: add sql.ref() helper (#4402) (b695811)
  • core: add cursor-based pagination via em.findByCursor() (#3975) (1e6825f)
  • core: add customizable LoggerContext with labeling support (#4233) (b985646), closes #4230
  • core: add support for indexes on JSON properties (#4735) (82c8629), closes #1230
  • core: allow extending EntityManager (#5064) (6c363e7)
  • core: allow inferring populate hint from filter via populate: ['$infer'] (#4939) (080fdbb), closes #1309
  • 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 passing string values for PopulateHint enum (populateWhere) (2bd21eb)
  • core: allow populating collections with references (#4776) (3da6c39), closes #1158
  • core: allow setting logger context on EM level (#5023) (7e56104), closes #5022
  • core: auto-join M:1 and 1:1 relations with filters (#5063) (66a6b75), closes #4975
  • core: infer property type from default value (#4150) (38be986), closes #4060
  • core: re-export the core package from all drivers (#3816) (175c059)
  • core: remove static require calls (#3814) (b58f476), closes #3743
  • core: require explicitly marked raw queries via raw() helper (#4197) (9c1b205)
  • core: 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: 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 #3657
  • core: support mapping one column to different STI properties (#4769) (e8d391b), closes #2388 #4440
  • entity-generator: allow generating scalar properties for FKs (#4892) (abad6ca), closes #4898
  • entity-generator: allow local and global configuration of all options (#4965) (2876b8a)
  • entity-generator: detect more ManyToMany relations (#4974) (d0e3ac9)
  • mysql: support order by nulls first/last (#5021) (df75b24), closes #5004
  • postgres: add support for native enums (#4296) (8515380), closes #2764
  • 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/clear (6a12fe1)
  • sql: add native support for generated columns (#4884) (a928291)
  • sql: rework joined strategy to support the default populateWhere: 'all' (#4957) (e5dbc24)
  • sql: support $some, $none and $every subquery operators (#4917) (50d2265), closes #2916
  • sql: use joined strategy as default for SQL drivers (#4958) (90ec766)
  • sql: use returning statements for reloading version fields on update (0a3abd7)

BREAKING CHANGES

  • core: FindOptions.fields now accepts only array of strings, like populate.

5.9.2 (2023-11-02)

Bug Fixes

  • core: fix partial loading of embedded properties with joined strategy (f887e77)
  • core: ignore limit, offset and order in em.count on virtual entity (03a7b86)

5.9.1 (2023-10-31)

Bug Fixes

  • postgres: fix hydrating of serial properties via returning statement (620309c)

5.9.0 (2023-10-24)

Bug Fixes

  • core: apply convertToJSValueSQL on composite FKs too (41425cb), closes #4843
  • query-builder: do not alias formula expressions used in qb.groupBy() (e27e4b9), closes #2929
  • query-builder: respect preferReadReplicas in QueryBuilder (22e140e), closes #4847

Features

  • core: allow ignoring undefined values in em.find queries (#4875) (e163bfb), closes #4873
  • query-builder: respect EntityManager schema (#4849) (5bc12a9)

5.8.10 (2023-10-18)

Bug Fixes

  • knex: fix populating M:N from inverse side with joined strategy (9f82e95)

5.8.9 (2023-10-15)

Bug Fixes

  • core: ignore SQL convertor methods on object embeddables (92e1d6f), closes #4824
  • query-builder: merge raw join results in qb.execute() (#4825) (5a28e9b), closes #4816 #4741
  • schema: skip changes of enum items on enum arrays (9accdf6), closes #476

5.8.8 (2023-10-11)

Note: Version bump only for package @mikro-orm/knex

5.8.7 (2023-10-05)

Bug Fixes

  • core: improve handling of nullable embedded properties (eae7e38), closes #4787
  • schema: respect length of default value of datetime columns (cbc0c50), closes #4782

5.8.6 (2023-10-02)

Bug Fixes

  • core: alias joins on non persistent properties (d70d323), closes #4773

5.8.5 (2023-09-30)

Bug Fixes

  • core: allow joining a formula property (1200e5b), closes #4759
  • core: map virtual properties that shadow a regular property from joined results (d0b3698), closes #4764
  • core: pin all internal dependencies (f4868ed), closes #4764
  • core: support overlapping composite FKs with different nullability (208fbaa), closes #4478

5.8.4 (2023-09-27)

Bug Fixes

  • query-builder: fix mapping of complex joined results with cycles (a9846dd), closes #4741

5.8.3 (2023-09-24)

Bug Fixes

  • knex: allow using knex query builder as virtual entity expression (#4740) (427cc88), closes #4628
  • knex: hydrate nullable relations with joined strategy (8ddaa93), closes #4675

5.8.2 (2023-09-20)

Bug Fixes

  • query-builder: fix aliasing of joined embedded properties (24c4ece), closes #4711

5.8.1 (2023-09-12)

Bug Fixes

  • core: fix merging of collections loaded via joined strategy (b4a0260), closes #4694
  • core: try to fix merging of large collections loaded via joined strategy (faae84e), closes #4694

5.8.0 (2023-09-10)

Bug Fixes

  • core: ensure partial loading respects advanced mapped type methods (72554fd), closes #4622
  • core: map property names to column names in qb.onConflict() (e38d126), closes #4483
  • core: remove old items from 1:m collections via set() even if not initialized (b03e165)
  • core: respect explicit schema name of pivot tables (af74491), closes #4516
  • core: respect filters with joined loading strategy (#4683) (847c35a), closes #704 #2440
  • core: use join on conditions for populateWhere (#4682) (99177cc), closes #3871
  • entity-generator: respect precision and scale in numeric column type (3a52c39)
  • query-builder: apply join condition to the target entity in M:N relations (c78d812), closes #4644

Features

  • core: allow fine-grained control over em.upsert() (#4669) (ab0ddee), closes #4325 #4602
  • entity-generator: allow skipping some tables or columns (e603108), closes #4584
  • sql: add readOnly option to em.begin() and em.transactional() (86bb7d4)
  • sql: allow specifying query comments (06d4d20)

5.7.14 (2023-07-27)

Note: Version bump only for package @mikro-orm/knex

5.7.13 (2023-07-16)

Bug Fixes

  • core: fix handling shared columns in composite foreign keys (fbb6958)
  • core: fix multiple ? in fulltext fields updates (9c9915e), closes #4484
  • sql: schema not inherited in query with relations (#4477) (b680477), closes #4472

5.7.12 (2023-06-10)

Bug Fixes

  • core: fix returning clause for upsert with embeddables (#4427) (b9682f0)
  • core: respect undefined when assigning to object properties (217ff8f), closes #4428

5.7.11 (2023-06-01)

Note: Version bump only for package @mikro-orm/knex

5.7.10 (2023-05-23)

Bug Fixes

  • core: exclude collections from returning clause from em.upsert (e342449), closes #4382

Performance Improvements

  • core: set Collection._property early for managed entities (23ca682), closes #4376

5.7.9 (2023-05-22)

Note: Version bump only for package @mikro-orm/knex

5.7.8 (2023-05-21)

Bug Fixes

  • core: ensure em.upsert returns initialized entity (#4370) (bad0b37), closes #4242
  • core: ensure correct number of results is logged in SQL drivers (e3cd184)
  • query-builder: qb.clone() shouldn't ignore groupBy and having clauses (7127ff6)

Features

  • query-builder: add qb.returning() (b5ab66b)
  • query-builder: allow partial loading via qb.(left/inner)JoinAndSelect() (22c8c84), closes #4364

5.7.7 (2023-05-14)

Bug Fixes

  • core: revert the const enums as they break projects with isolatedModules (8b23674), closes #4350
  • knex: remove constraints from knex's peer dependencies (ce81071)
  • query-builder: do not enable query pagination when explicit groupBy is set (921251a), closes #4353

Features

  • query-builder: validate unknown alias when explicitly joining (8d4a83a), closes #4353

5.7.6 (2023-05-13)

Bug Fixes

  • core: allow em.populate() on lazy formula properties (5c6bb13)

Performance Improvements

  • core: define some enums as const enums, so they get inlined (3cb43ba)

5.7.5 (2023-05-09)

Note: Version bump only for package @mikro-orm/knex

5.7.4 (2023-05-01)

Note: Version bump only for package @mikro-orm/knex

5.7.3 (2023-04-28)

Note: Version bump only for package @mikro-orm/knex

5.7.2 (2023-04-25)

Bug Fixes

  • core: quote JSON property paths if they contain special characters (a94bbce), closes #4264

5.7.1 (2023-04-25)

Note: Version bump only for package @mikro-orm/knex

5.7.0 (2023-04-23)

Bug Fixes

  • core: detect JsonType based on columnType (#4252) (2e01622), closes #4229
  • core: rework JSON value processing (#4194) (5594c46), closes #4193
  • query-builder: fix pagination when PK uses BigIntType (b789031), closes #4227
  • query-builder: support onConflict().ignore() without parameters (3a3b0bd), closes #4224
  • schema: fix comparing default value of JSON properties (41277a1), closes #4212

Features

  • core: deprecate persist/flush/remove methods from EntityRepository (#4259) (eba4563), closes #3989

5.6.16 (2023-04-04)

Bug Fixes

  • migrations: do not interact with the database when snapshot exists (48df462)

Reverts

  • Revert "chore(release): v5.6.16 [skip ci]" (49faac9)

5.6.15 (2023-03-18)

Bug Fixes

  • core: deduplicate columns in insert queries (db734d6)

5.6.14 (2023-03-12)

Bug Fixes

  • postgres: use explicit schema in table identifier when altering comments (#4123) (60d96de), closes #4108
  • query-builder: ensure inner paginate query selects sub-queries used in orderBy (22b7146), closes #4104
  • query-builder: fix update query with auto-join of 1:1 owner (0a053fe), closes #4122

5.6.13 (2023-03-01)

Note: Version bump only for package @mikro-orm/knex

5.6.12 (2023-02-26)

Bug Fixes

  • core: ensure custom types are processed in em.upsert/upsertMany/insertMany (53a08ac), closes #4070

5.6.11 (2023-02-17)

Note: Version bump only for package @mikro-orm/knex

5.6.10 (2023-02-17)

Performance Improvements

  • core: improve result mapping and snapshotting (#4053) (8bb0268)

5.6.9 (2023-02-10)

Bug Fixes

  • query-builder: respect qb.joinAndSelect when serializing (4025869), closes #4034 #3812

5.6.8 (2023-01-25)

Bug Fixes

  • mysql: fix reloading of database defaults for complex composite PKs (d36af00), closes #3965

5.6.7 (2023-01-13)

Note: Version bump only for package @mikro-orm/knex

5.6.6 (2023-01-10)

Bug Fixes

  • core: make FilterQuery strict again! (5427097)

5.6.5 (2023-01-09)

Note: Version bump only for package @mikro-orm/knex

5.6.4 (2023-01-04)

Bug Fixes

  • core: respect transaction context in em.execute() (832105d), closes #3896

Features

5.6.3 (2022-12-28)

Note: Version bump only for package @mikro-orm/knex

5.6.2 (2022-12-25)

Bug Fixes

  • core: respect * in partial loading with joined strategy (7781f84), closes #3868

5.6.1 (2022-12-20)

Bug Fixes

  • core: fix populating relation with composite FK as primary key (b27578f), closes #3844
  • postgres: compare only simplified versions of check constraints (0fd8530), closes #3827

5.6.0 (2022-12-09)

Bug Fixes

  • core: make ChangeSet.getPrimaryKey() response stable (d32c956)
  • mysql: respect auto_increment_increment when batch inserting (516db6d), closes #3828
  • query-builder: fix cloning QB in some cases (c3b4c20), closes #3720
  • query-builder: fix querying for a composite FK when target is joined (dec4c9c), closes #3738
  • query-builder: respect case-insensitive regexp flag (1a1d381), closes #3801
  • query-build: fix query execution inside hooks sometimes hanging (dba6ce2)
  • schema: do not cache knex instance (dc00374), closes #3713
  • schema: ensure database exists before dropping schema (fd4c416), closes #3713

Features

5.5.3 (2022-11-10)

Note: Version bump only for package @mikro-orm/knex

5.5.2 (2022-11-07)

Bug Fixes

  • knex: always skip virtual properties in returning clause (#3699) (c084dde)

5.5.1 (2022-11-05)

Bug Fixes

  • core: fix querying for a complex composite key via inverse side (b99e7bb), closes #3669
  • core: handle $fulltext search correctly in nested queries (9a2f535), closes #3696
  • embeddables: support partial loading hints (0c33e00), closes #3673
  • knex: ensure virtual properties are never part of returning clause (35d51fe), closes #3664

Features

  • core: add context param to Type.convertToDatabaseValue() (a933e98), closes #3567

5.5.0 (2022-10-23)

Bug Fixes

  • core: fix removing entities with complex composite keys (6d6e9f4), closes #3543
  • query-builder: support top level $not operator in join condition (#3609) (047504f)

Features

  • core: add em.upsert() method (#3525) (3285cdb), closes #3515
  • mongo: do not expand array queries to $in operator when nested inside $eq (e25d28e)
  • postgres: add qb.distinctOn() support (307d3a1)
  • query-builder: validate modification of finalized QB (b23f015), closes #3534
  • schema: add ability to ignore specific column changes (#3503) (05fb1ce), closes #1904 #1904
  • sqlite: enable returning statements in both SQLite drivers (eaf83c8)

Performance Improvements

  • schema: improve schema inspection speed in SQL drivers (#3549) (74dc3b1)

5.4.2 (2022-09-12)

Features

  • knex: allow changing FROM clause using QueryBuilder (#3378) (df7d939)

5.4.1 (2022-09-08)

Bug Fixes

  • core: change internal dependencies to use ~ instead of ^ (fdbf67c), closes #3468
  • core: support partial loading of inlined embeddables (9654e6e), closes #3365
  • postgres: fix inserting values with ? into FullTextType properties (5095ddb), closes #3457

5.4.0 (2022-09-01)

Bug Fixes

  • core: update to TypeScript 4.8 and improve EntityDTO type (#3389) (f2957fb)
  • knex: support em.count() on virtual entities (5bb4ebe)
  • query-builder: allow using alias for delete queries (aa19a85), closes #3366
  • query-builder: support more operators in join conditions (#3399) (af885c8)

5.3.1 (2022-08-04)

Note: Version bump only for package @mikro-orm/knex

5.3.0 (2022-08-01)

Bug Fixes

  • postgres: fix having non-PK serial column next to a non-serial PK (6c589b0), closes #3350
  • query-builder: fix qb.insert()/update() on embeddables in inline mode (#3340) (e611fa0)
  • schema: respect explicit columnType when comparing columns (f0a20fa), closes #3317
  • schema: respect schema when renaming columns in postgres (#3344) (f905336)

Features

  • add support for full text searches (#3317) (8b8f140)
  • core: add $exists mongodb operator with SQL fallback to is not null (112f2be), closes #3295
  • core: add support for virtual entities (#3351) (dcd62ac)

5.2.4 (2022-07-25)

Bug Fixes

  • knex: fix $or over 1:m and m:1 auto-joined relations (#3307) (b6f12b2)

Features

  • knex: allow partial loading of 1:1 owner property from inverse side (d642018), closes #3324

5.2.3 (2022-07-08)

Note: Version bump only for package @mikro-orm/knex

5.2.2 (2022-07-03)

Bug Fixes

  • sql: fix prefixing of JSON queries nested on relations (847ff46), closes #3242

5.2.1 (2022-06-21)

Bug Fixes

  • core: prefer current schema for loading wild card pivot table entities (f40cafa), closes #3177

5.2.0 (2022-06-10)

Bug Fixes

  • core: allow changing PK via UoW (32ab215), closes #3184
  • query-builder: fix calling qb.count('id', true).getCount() (a97324a), closes #3182
  • query-builder: fix processing of custom types in explicitly aliased queries (db137a6), closes #3172
  • typing detection with typescript 4.7 node16 (#3163) (08322fa)

Features

  • knex: allow reusing existing knex client via driverOptions (c169eda), closes #3167
  • schema: add logging to schema comparator (f96eaaf)

5.1.5 (2022-05-29)

Bug Fixes

  • query-builder: fix aliasing of relations with composite PK (095e241), closes #3053

Performance Improvements

  • query-builder: use distinct counts only when joining to-many relations (eebe34d), closes #3044

5.1.4 (2022-05-19)

Bug Fixes

  • core: fix aliasing of formula properties in complex conditions (#3130) (071846e)
  • core: improve type of em.getContext() (158f077), closes #3120
  • postgres: do not try to create schema for migrations when it exists (d6af811), closes #3106

5.1.3 (2022-04-27)

Bug Fixes

  • schema: remove FKs first when trying to dropSchema without disabled FKs (b1b5f55), closes #3004
  • sqlite: upgrade knex to v2 + switch back to sqlite3 (f3e4b9d), closes #3046

5.1.2 (2022-04-10)

Bug Fixes

  • core: do not quote knex.raw() instances returned from custom types (8a4c836), closes #1841
  • core: fix mapping of inserted PKs with custom field names from batch insert (080d8e0), closes #2977
  • core: support PopulateHint.INFER with pagination and joined strategy (56f8737), closes #2985
  • postgres: do not ignore custom PK constraint names (#2931) (24bf10e)

Features

  • mariadb: implement check constraint support + fix json column diffing (b513b16), closes #2151
  • schema: support mysql 8 (#2961) (acc960e)

5.1.1 (2022-03-20)

Bug Fixes

  • core: fix custom pivot table entities for unidirectional relations (01bdbf6)
  • knex: order by with a formula field should not include as for sub-queries (#2929) (74751fb)
  • postgres: allow explicit schema name in prop.pivotTable (1860ff5), closes #2919
  • postgres: fix pagination with order by UUID PK (042626c), closes #2910

5.1.0 (2022-03-13)

Bug Fixes

  • core: do not alias JSON conditions on update/delete queries (5c0674e), closes #2839
  • core: fix ordering by complex composite PKs (dde11d3), closes #2886
  • knex: order by with a formula field should not include as (#2848) (09e8bfa)
  • knex: fully qualify sub-query order-by fields (#2835) (f74dc73)
  • postgres: respect schema name in migration storage (fbf9bfa), closes #2828

Features

  • core: allow better control over connection type when using read-replicas (#2896) (e40ae2d)
  • core: allow forcing write connection via forceWriteConnection (#2838) (36d1969)
  • core: allow specifying custom pivot table entity (#2901) (8237d16)
  • core: enable QueryFlag.PAGINATE automatically for em.find() (ccb4223), closes #2867

5.0.5 (2022-02-27)

Bug Fixes

  • core: fix auto-joining multiple 1:1 properties (0566e74), closes #2821
  • knex: respect explicit transaction in em.count() (#2818) (2d26a63)
  • query-builder: use paginate flag automatically based on to-many joins (db9963f), closes #2823

5.0.4 (2022-02-22)

Bug Fixes

  • schema: escape table/column comments (fff1581), closes #2805

5.0.3 (2022-02-20)

Bug Fixes

  • core: do not trigger global context validation from repositories (f651865), closes #2778

Features

5.0.2 (2022-02-16)

Bug Fixes

  • core: do not ignore schema name in batch queries (b47393e)
  • core: do not ignore schema name in collection updates (d688dc1)
  • postgres: do not ignore custom PK constraint names (3201ef7), closes #2762

5.0.1 (2022-02-13)

Bug Fixes

  • core: allow using 0 as PK (a2e423c), closes #2729
  • query-builder: respect explicit entity schema (717aa5e), closes #2740
  • schema: fix explicit schema name support (#2752) (68631ea)

Features

  • query-builder: allow autocomplete on qb.orderBy() (fdf03c3), closes #2747

5.0.0 (2022-02-06)

Bug Fixes

  • core: allow non-standard property names (hyphens, spaces, ...) (cc68230), closes #1958
  • core: do not ignore qb.onConflict(...).merge() without params (527e188), closes #1774
  • core: ensure correct aliasing when auto-joining PKs in group conditions (38775e6), closes #1734
  • core: fix QueryFlag.PAGINATE with joined loading strategy (c6d72b8)
  • core: fix M:N relations with custom type PKs (3cdc786), closes #1930
  • core: fix nested query with fk as pk (#2650) (cc54ff9), closes #2648
  • core: fix ordering by json properties (741959f)
  • core: fix ordering by pivot table with explicit schema name (eb1f9bb), closes #2621
  • core: fix pivot tables for wild card schema entities (623dc91), closes #2690
  • core: fix populating entities with wildcard schema (98d0bfb)
  • core: fix propagation of locking option with select-in population (f3990d0), closes #1670
  • core: fix querying by JSON properties (73108b1), closes #1673
  • core: fix removing of m:n items when one is composite (81c0b30), closes #1961
  • core: fix support for nested composite PKs (14dcff8), closes #2647
  • core: improve partial loading of 1:m relations (3ddde1e), closes #2651
  • core: initialize empty collections when fetch joining (02714e5)
  • core: mark entity generator and migrations as peer deps of knex (0e24473), closes #1879
  • core: respect read replica options (#2152) (9ec668d), closes #1963
  • core: respect request context when creating QB (a2b7b84), closes #2669
  • core: update version values in batch updates (8476400), closes #1703
  • core: use $and for merging of multiple filter conditions (0a0622a), closes #1776
  • entity-generator: fix boolean default values (908a638), closes #1917
  • knex: quote version column (#2402) (5bbbd15), closes #2401
  • mongo: validate usage of migrator and entity generator (1db1a63), closes #1801
  • postgres: allow type casting in nested conditions (bbd0eb4), closes #2227
  • query-builder: allow passing array of keys to qb.onConflict().merge() (e4a1cf0), closes #1774
  • query-builder: do not wipe previously defined conditions with qb.delete() (b8a5154), closes #2136
  • query-builder: fix mapping of formula properties (2607266), closes #1599 #2705
  • query-builder: fix nested ordered pagination (#2351) (c5a5c6b)
  • query-builder: respect 0 as limit (#2700) (3f284ed)
  • query-builder: support joining same property multiple times (b62fb05), closes #2602
  • query-builder: translate field names in qb.merge() (5aead23), closes #2177
  • query-builder: validate missing onConflict calls (30392bc), closes #1803
  • schema: do not ignore entity level indexes with just expression (0ee9c4d), closes #2706
  • schema: improve diffing of default values for strings and dates (d4ac638), closes #2385
  • sql: split $and branches when auto joining to-many relations (70c795a), closes #2677
  • validation: throw when calling qb.update/delete() after qb.where() (96893e0), closes #2390

chore

  • upgrade typescript to v4.5.2 (2bd8220)

Code Refactoring

  • core: PrimaryKeyType symbol should be defined as optional (db0b399)
  • core: use options parameters on SchemaGenerator (7e48c5d)
  • use options parameters in IDatabaseDriver (#2204) (9a32ac0)

Features

  • core: add QueryFlag.AUTO_JOIN_ONE_TO_ONE_OWNER (be9d9e1), closes #1660
  • core: add custom table check constraint support for postgres (#2688) (89aca5f)
  • core: add index/key name to naming strategy (a842e3e)
  • core: add support for advanced locking (0cbed9c), closes #1786
  • core: add support for concurrency checks (#2437) (acd43fe)
  • core: add support for custom property ordering (#2444) (40ae4d6)
  • core: add support for ESM via gen-esm-wrapper (aa71065), closes #1010
  • core: add support for multiple schemas (including UoW) (#2296) (d64d100), closes #2074
  • core: add support for polymorphic embeddables (#2426) (7b7c3a2), closes #1165
  • core: allow configuring aliasing naming strategy (#2419) (89d63b3)
  • core: allow defining check constraints via callback (965f740), closes #2688 #1711
  • core: allow passing arrays in orderBy parameter (#2211) (0ec22ed), closes #2010
  • core: allow providing custom Logger instance (#2443) (c7a75e0)
  • core: allow using short lived tokens in config (4499838), closes #1818
  • core: implement auto-flush mode (#2491) (f1d8bf1), closes #2359
  • core: implement partial loading support for joined loading strategy (2bebb5e), closes #1707
  • core: make em.create() respect required properties (2385f1d)
  • core: make FindOptions.fields strictly typed (dot notation) (fd43099)
  • core: make populate parameter strictly typed with dot notation (3372f02)
  • core: support column names with spaces (00b54b4), closes #1617
  • core: validate version mismatch in ORM packages (cf70219)
  • embeddables: allow using m:1 properties inside embeddables (#1948) (ffca73e)
  • entity-generator: add enum generation support (#2608) (1e0b411)
  • entity-generator: add support for generating M:N properties (c0628c5)
  • entity-generator: allow specifying schema (beb2993), closes #1301
  • filters: add em parameter to the filter callback parameters (6858986), closes #2214
  • knex: export also global knex function (383bc24)
  • migrations: use snapshots for generating diffs in new migrations (#1815) (9c37f61)
  • mongo: add SchemaGenerator support for mongo (#2658) (cc11859)
  • query-builder: add qb.getCount() method (f773736), closes #2066
  • query-builder: allow awaiting the QueryBuilder instance (#2446) (c1c4d51)
  • query-builder: improve typing of qb.execute() (c4cfedb), closes #2396
  • schema: add support for timestamp columns in mysql (a224ec9), closes #2386
  • schema: allow disabling foreign key constraints (fcdb236), closes #2548
  • schema: rework schema diffing (#1641) (05f15a3), closes #1486 #1518 #579 #1559 #1602 #1480 #1687
  • sql: add qb.indexHint() method that appends to the from clause (ce89e1f), closes #1663
  • sql: add callback signature to expr() with alias parameter (48702c7), closes #2405
  • sql: allow setting transaction isolation level (6ae5fbf), closes #819
  • sql: generate down migrations automatically (#2139) (7d78d0c)
  • typings: make em.create() and other methods strict (#1718) (e8b7119), closes #1456

BREAKING CHANGES

  • core: Previously when we had nonstandard PK types, we could use PrimaryKeyType symbol to let the type system know it. It was required to define this property as required, now it can be defined as optional too.
  • core: em.create() will now require you to pass all non-optional properties. Some properties might be defined as required for TS but we have a default value for them (either runtime, or database one) - for such we can use OptionalProps symbol to specify which properties should be considered as optional.
  • Previously it was possible to call em.populate() with a single entity input, and the output would be again just a single entity.

Due to issues with TS 4.5, this method now always return array of entities. You can use destructing if you want to have a single entity return type:

const [loadedAuthor] = await em.populate(author, ...);
  • core: Embeddable instances are now created via EntityFactory and they respect the forceEntityConstructor configuration. Due to this we need to have EM instance when assigning to embedded properties.

Using em.assign() should be preferred to get around this.

Deep assigning of child entities now works by default based on the presence of PKs in the payload. This behaviour can be disable via updateByPrimaryKey: false in the assign options.

mergeObjects option is now enabled by default.

  • core: Previously with select-in strategy as well as with QueryBuilder, table aliases were always the letter e followed by unique index. In v5, we use the same method as with joined strategy - the letter is inferred from the entity name.

This can be breaking if you used the aliases somewhere, e.g. in custom SQL fragments. We can restore to the old behaviour by implementing custom naming strategy, overriding the aliasName method:

import { AbstractNamingStrategy } from '@mikro-orm/core';

class CustomNamingStrategy extends AbstractNamingStrategy {
aliasName(entityName: string, index: number) {
return 'e' + index;
}
}

Note that in v5 it is possible to use expr() helper to access the alias name dynamically, e.g. expr(alias => `lower('${alias}.name')`), which should be now preferred way instead of hardcoding the aliases.

  • core: em.getReference() now has options parameter.
  • Most of the methods on IDatabaseDriver interface now have different signature.
  • core: Populate parameter is now strictly typed and supports only array of strings or a boolean. Object way is no longer supported. To set loading strategy, use FindOptions.strategy.
  • core: SchemaGenerator API changed, boolean parameters are now removed in favour of options objects
interface SchemaGenerator {
generate(): Promise<string>;
createSchema(options?: { wrap?: boolean }): Promise<void>;
ensureDatabase(): Promise<void>;
getCreateSchemaSQL(options?: { wrap?: boolean }): Promise<string>;
dropSchema(options?: { wrap?: boolean; dropMigrationsTable?: boolean; dropDb?: boolean }): Promise<void>;
getDropSchemaSQL(options?: { wrap?: boolean; dropMigrationsTable?: boolean }): Promise<string>;
updateSchema(options?: { wrap?: boolean; safe?: boolean; dropDb?: boolean; dropTables?: boolean }): Promise<void>;
getUpdateSchemaSQL(options?: { wrap?: boolean; safe?: boolean; dropDb?: boolean; dropTables?: boolean }): Promise<string>;
createDatabase(name: string): Promise<void>;
dropDatabase(name: string): Promise<void>;
execute(sql: string, options?: { wrap?: boolean }): Promise<void>;
}
  • sql: - em.transactional() signature has changed, the parameter is now options object
  • em.begin() signature has changed, the parameter is now options object
  • core: Signature of em.populate() changed, it now uses options parameter.
-populate<P>(entities: T, populate: P, where?: FilterQuery<T>, orderBy?: QueryOrderMap,
- refresh?: boolean, validate?: boolean): Promise<Loaded<T, P>>;
+populate<P>(entities: T,populate: P, options?: EntityLoaderOptions<T>): Promise<Loaded<T, P>>;
  • typings: Some methods are now strictly typed, so previously fine usages might be restricted on TS level. To get around those, we might either cast as any, provide the generic T type as any, or use expr helper.
em.create(User, { someNotDefinedProp: 123 }); // throws if someNotDefinedProp not on the User
em.create(User, { [expr('someNotDefinedProp')]: 123 }); // works, using expr
em.create<any>(User, { someNotDefinedProp: 123 }); // works, using type cast
em.create(User, { someNotDefinedProp: 123 } as any); // works, using type cast

4.5.10 (2021-12-26)

Note: Version bump only for package @mikro-orm/knex

4.5.9 (2021-08-24)

Note: Version bump only for package @mikro-orm/knex

4.5.8 (2021-08-24)

Bug Fixes

  • query-builder: do not wipe previously defined conditions with qb.delete() (380fe3d), closes #2136

4.5.7 (2021-06-30)

Bug Fixes

  • core: fix M:N relations with custom type PKs (ed399b1), closes #1930
  • core: fix removing of m:n items when one is composite (8084845), closes #1961
  • entity-generator: fix boolean default values (219fc0c), closes #1917

4.5.6 (2021-06-06)

Bug Fixes

  • core: mark entity generator and migrations as peer deps of knex (4ad80af), closes #1879

4.5.5 (2021-05-17)

Bug Fixes

  • core: do not ignore qb.onConflict(...).merge() without params (68b570e), closes #1774
  • core: ensure correct aliasing when auto-joining PKs in group conditions (ec971b6), closes #1734
  • core: fix ordering by json properties (53bef71)
  • core: use $and for merging of multiple filter conditions (19f3f1d), closes #1776
  • mongo: validate usage of migrator and entity generator (e41d1c5), closes #1801
  • query-builder: allow passing array of keys to qb.onConflict().merge() (fc3cf01), closes #1774
  • query-builder: validate missing onConflict calls (d9ae997), closes #1803

4.5.4 (2021-04-26)

Bug Fixes

  • core: fix QueryFlag.PAGINATE with joined loading strategy (11aa0a3)
  • core: fix querying by JSON properties (bc5e1a9), closes #1673
  • core: initialize empty collections when fetch joining (6fb9560)
  • core: update version values in batch updates (f5c8ed8), closes #1703

Features

  • core: add QueryFlag.AUTO_JOIN_ONE_TO_ONE_OWNER (378e468), closes #1660

4.5.3 (2021-04-09)

Bug Fixes

  • core: do not auto-join composite relations when not needed (b1420a6), closes #1658
  • core: fix aliasing of embeddables in update query (#1650) (6cb5f62)
  • knex: find by custom types with object subconditions (#1656) (d8c328a)

Features

  • query-builder: allow passing raw query bindings via qb.raw() (aa423a5), closes #1654

4.5.2 (2021-04-06)

Bug Fixes

  • core: fix mapping of complex composite keys (c0c658e), closes #1624
  • core: fix querying embeddables over cast fields (#1639) (cb5b25c)
  • core: support advanced custom types in batch queries (88cc71e), closes #1625
  • knex: find entity by advanced custom types (#1630) (ef945d5)

4.5.1 (2021-03-27)

Bug Fixes

  • core: support Collection.loadCount for unidirectional M:N (27e4dd2), closes #1608
  • core: support sql fragments in custom types with joined strategy (527579d), closes #1594

4.5.0 (2021-03-21)

Bug Fixes

  • core: do not process knex.ref() via custom types (ba2ee70), closes #1538
  • core: fix auto-joining with $not operator (8071fd0), closes #1537

Features

4.4.4 (2021-02-21)

Bug Fixes

  • core: improve quoting of advanced custom types (cda3638)

4.4.3 (2021-02-14)

Bug Fixes

  • core: handle convertToJSValueSQL at QB level too (fbb2825), closes #1432
  • core: quote custom type aliases (#1415) (6f6d1ec)

4.4.2 (2021-02-04)

Features

4.4.1 (2021-02-01)

Bug Fixes

4.4.0 (2021-01-24)

Bug Fixes

  • core: allow using lazy flag with formulas (4b2b5ce), closes #1229
  • core: fix pessimistic locking via em.findOne() (a0419a4), closes #1291
  • mysql: enforce 64 character limit for identifier names in SQL (#1297) (9c83b6d), closes #1271
  • schema: fix index name with explicit schema (b62d9ec), closes #1215
  • schema: fix renaming of multiple columns at the same time (677a2b7), closes #1262
  • sql: sort fetch-joined properties on their orderBy (#1336) (f18cd88), closes #1331

Features

4.3.4 (2020-12-11)

Bug Fixes

  • knex: reject in commit() method if commit statement fails (#1177) (f3beb7f), closes #1176
  • sql: ensure correct order of results when fetch joining (7453816), closes #1171
  • sql: use __ when aliasing fetch-joined properties (1479366), closes #1171

4.3.3 (2020-12-04)

Bug Fixes

  • core: fix snapshotting of composite properties (b5f19f2), closes #1079
  • schema: fix diffing tables in other than default schema (429d832), closes #1142 #1143
  • sql: allow no results in em.count() (bc3cdf6), closes #1135

4.3.2 (2020-11-24)

Bug Fixes

  • sql: allow using raw value for JSON prop with custom type (2a17c59), closes #1112

4.3.1 (2020-11-20)

Bug Fixes

  • core: do not interpolate escaped question marks (c54c2a2)

4.3.0 (2020-11-13)

Bug Fixes

  • core: ensure correct grouping and commit order for STI (8b77525), closes #845
  • core: pin dependencies (0f3a8e5), closes #961
  • schema: do not add unique constraint to PKs (a7da03d), closes #1064
  • schema: ensure we do not ignore some columns (5d7dfc1), closes #1009
  • sql: allow using dot inside custom order by expression (11e8c56), closes #1067
  • sql: convert custom types at query builder level (83d3ab2)
  • sql: fix populating M:N via joined strategy with conditions (7113827), closes #1043
  • sql: implement diffing of simple scalar indexes (dc81ef0), closes #957
  • sql: inline array parameters when formatting queries (a21735f), closes #1021
  • sql: interpolate ?? as identifier (a3d4c09), closes #983

Features

  • core: maintain transaction context automatically (#959) (e0064e4)
  • query-builder: allow mapping of complex joined results (#988) (60dd2d8), closes #932

4.2.3 (2020-10-24)

Bug Fixes

  • core: ensure qb.getFormattedQuery() works with postgres (63b2521)

4.2.2 (2020-10-22)

Bug Fixes

  • core: fix mapping of params with custom types (e5049b1), closes #940
  • schema: make sure we do not create FK columns twice in sqlite (1eb6374), closes #942

4.2.1 (2020-10-20)

Note: Version bump only for package @mikro-orm/knex

4.2.0 (2020-10-18)

Bug Fixes

  • schema: improve column type equality check (#925) (152f399)

Features

  • core: add basic (in-memory) result caching (2f8253d)
  • core: allow storing embeddables as objects (#927) (ba881e6), closes #906

4.1.1 (2020-10-14)

Bug Fixes

  • postgres: escape question marks in parameters (813e3cd), closes #920

4.1.0 (2020-10-12)

Bug Fixes

  • schema: allow using non-abstract root entity in STI (9dd3aed), closes #874
  • schema: make STI metadata discovery order independent (f477a48), closes #909
  • sqlite: rework schema support for composite keys in sqlite (82e2efd), closes #887
  • typings: improve inference of the entity type (67f8015), closes #876

Performance Improvements

  • core: implement bulk updates in mongo driver (5f347c1), closes #732
  • core: implement bulk updates in sql drivers (b005353), closes #732
  • core: interpolate query parameters at ORM level (742b813), closes #732
  • core: use dedicated identity maps for each entity (84667f9), closes #732
  • core: use faster way to check number of object keys (82f3ee4), closes #732
  • core: use JIT compiled PK getters/serializers (0ec99dc), closes #732
  • core: use raw sql for batch updates (1089c57), closes #732

4.0.7 (2020-09-24)

Features

  • core: add groupBy, having and schema to CountOptions (d3c3858)

Performance Improvements

  • core: use batch inserts in UoW (postgres & mongodb) (#865) (54ad928), closes #732

4.0.6 (2020-09-22)

Bug Fixes

  • query-builder: do not select 1:1 owner when auto-joining (86c3032), closes #858
  • query-builder: fix auto-joining of 1:m PKs (920995f), closes #857
  • query-builder: fix count query with auto-joining of 1:1 (9b8056c), closes #858
  • query-builder: wrap nested array conditions with $in operator (939989a), closes #860

4.0.5 (2020-09-21)

Bug Fixes

  • schema: defer creating of composite indexes + implement diffing (f57b457), closes #850

4.0.4 (2020-09-19)

Bug Fixes

  • query-builder: fix mapping of 1:1 inverse sides (a46281e), closes #849
  • query-builder: fix mapping of nested 1:1 properties (9799e70)

Performance Improvements

  • move reference to metadata to entity prototype + more improvements (#843) (f71e4c2), closes #732

4.0.3 (2020-09-15)

Performance Improvements

  • core: do not use em.merge() internally (6a1a6d6)

4.0.2 (2020-09-11)

Note: Version bump only for package @mikro-orm/knex

4.0.1 (2020-09-10)

Bug Fixes

  • core: refactor internals to reduce number of cycles (#830) (3994767)