@mikro-orm/knex 5.7.8-dev.4 → 5.7.9-dev.0

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.
@@ -336,7 +336,8 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
336
336
  /* istanbul ignore next */
337
337
  qb.insert(data)
338
338
  .onConflict(uniqueFields.map(p => meta?.properties[p]?.fieldNames[0] ?? p))
339
- .merge(Object.keys(data).filter(f => !uniqueFields.includes(f)));
339
+ .merge(Object.keys(data).filter(f => !uniqueFields.includes(f)))
340
+ .returning(meta?.hydrateProps.filter(p => !p.lazy && !(p.name in data)).map(p => p.name) ?? '*');
340
341
  }
341
342
  else {
342
343
  qb.update(data).where(where);
@@ -356,8 +357,9 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
356
357
  const uniqueFields = core_1.Utils.isPlainObject(where[0]) ? Object.keys(where[0]) : meta.primaryKeys;
357
358
  const qb = this.createQueryBuilder(entityName, options.ctx, 'write', options.convertCustomTypes).withSchema(this.getSchemaName(meta, options));
358
359
  qb.insert(data)
359
- .onConflict(uniqueFields.map(p => meta?.properties[p]?.fieldNames[0] ?? p))
360
- .merge(Object.keys(data[0]).filter(f => !uniqueFields.includes(f)));
360
+ .onConflict(uniqueFields.map(p => meta.properties[p]?.fieldNames[0] ?? p))
361
+ .merge(Object.keys(data[0]).filter(f => !uniqueFields.includes(f)))
362
+ .returning(meta.hydrateProps.filter(p => !p.lazy && !(p.name in data[0])).map(p => p.name) ?? '*');
361
363
  return qb.execute('run', false);
362
364
  }
363
365
  const collections = options.processCollections ? data.map(d => this.extractManyToMany(entityName, d)) : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "5.7.8-dev.4",
3
+ "version": "5.7.9-dev.0",
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",
@@ -63,12 +63,12 @@
63
63
  "sqlstring": "2.3.3"
64
64
  },
65
65
  "devDependencies": {
66
- "@mikro-orm/core": "^5.7.7"
66
+ "@mikro-orm/core": "^5.7.8"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "~5.7.8-dev.4",
70
- "@mikro-orm/entity-generator": "~5.7.8-dev.4",
71
- "@mikro-orm/migrations": "~5.7.8-dev.4",
69
+ "@mikro-orm/core": "~5.7.9-dev.0",
70
+ "@mikro-orm/entity-generator": "~5.7.9-dev.0",
71
+ "@mikro-orm/migrations": "~5.7.9-dev.0",
72
72
  "better-sqlite3": "*",
73
73
  "mssql": "*",
74
74
  "mysql": "*",