@mikro-orm/knex 6.2.3-dev.3 → 6.2.3-dev.5

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.
@@ -454,7 +454,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
454
454
  .onConflict(uniqueFields)
455
455
  .returning(returning);
456
456
  if (!options.onConflictAction || options.onConflictAction === 'merge') {
457
- const fields = (0, core_1.getOnConflictFields)(data, uniqueFields, options);
457
+ const fields = (0, core_1.getOnConflictFields)(meta, data, uniqueFields, options);
458
458
  qb.merge(fields);
459
459
  }
460
460
  if (options.onConflictAction === 'ignore') {
@@ -489,7 +489,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
489
489
  .onConflict(uniqueFields)
490
490
  .returning(returning);
491
491
  if (!options.onConflictAction || options.onConflictAction === 'merge') {
492
- const fields = (0, core_1.getOnConflictFields)(data[0], uniqueFields, options);
492
+ const fields = (0, core_1.getOnConflictFields)(meta, data[0], uniqueFields, options);
493
493
  qb.merge(fields);
494
494
  }
495
495
  if (options.onConflictAction === 'ignore') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.2.3-dev.3",
3
+ "version": "6.2.3-dev.5",
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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -66,6 +66,6 @@
66
66
  "@mikro-orm/core": "^6.2.2"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.2.3-dev.3"
69
+ "@mikro-orm/core": "6.2.3-dev.5"
70
70
  }
71
71
  }
@@ -1255,6 +1255,10 @@ class QueryBuilder {
1255
1255
  subSubQuery.__raw = true; // tag it as there is now way to check via `instanceof`
1256
1256
  this._limit = undefined;
1257
1257
  this._offset = undefined;
1258
+ if (this._fields.some(f => core_1.RawQueryFragment.isKnownFragment(f))) {
1259
+ this.select(this._fields).where({ [core_1.Utils.getPrimaryKeyHash(meta.primaryKeys)]: { $in: subSubQuery } });
1260
+ return;
1261
+ }
1258
1262
  // remove joins that are not used for population or ordering to improve performance
1259
1263
  const populate = new Set();
1260
1264
  const orderByAliases = this._orderBy