@mikro-orm/sql 7.2.2-dev.26 → 7.2.2-dev.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.2.2-dev.26",
3
+ "version": "7.2.2-dev.28",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -53,7 +53,7 @@
53
53
  "@mikro-orm/core": "^7.2.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.2.2-dev.26"
56
+ "@mikro-orm/core": "7.2.2-dev.28"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
@@ -331,7 +331,9 @@ export class ObjectCriteriaNode extends CriteriaNode {
331
331
  else {
332
332
  const prev = qb.state.fields?.slice();
333
333
  const toOneProperty = [ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(this.prop.kind);
334
- const joinType = toOneProperty && !this.prop.nullable ? JoinType.innerJoin : JoinType.leftJoin;
334
+ // ordering must not drop rows whose polymorphic relation points to another target
335
+ const orderByPolymorphic = this.prop.polymorphic && options?.type === 'orderBy';
336
+ const joinType = toOneProperty && !this.prop.nullable && !orderByPolymorphic ? JoinType.innerJoin : JoinType.leftJoin;
335
337
  qb[method](field, nestedAlias, undefined, joinType, path);
336
338
  if (!qb.hasFlag(QueryFlag.INFER_POPULATE)) {
337
339
  qb.state.fields = prev;