@mikro-orm/mssql 7.2.7-dev.1 → 7.2.7-dev.10

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.
Files changed (2) hide show
  1. package/MsSqlDriver.js +3 -10
  2. package/package.json +3 -3
package/MsSqlDriver.js CHANGED
@@ -1,4 +1,4 @@
1
- import { QueryFlag, Utils, isRaw, } from '@mikro-orm/core';
1
+ import { QueryFlag, Utils, } from '@mikro-orm/core';
2
2
  import { AbstractSqlDriver } from '@mikro-orm/sql';
3
3
  import { MsSqlConnection } from './MsSqlConnection.js';
4
4
  import { MsSqlPlatform } from './MsSqlPlatform.js';
@@ -31,20 +31,13 @@ export class MsSqlDriver extends AbstractSqlDriver {
31
31
  sql = this.appendOutputTable(entityName, returningFields, sql, sql.length - 1, options);
32
32
  }
33
33
  const res = await this.execute(sql, [], 'run', options.ctx);
34
- const pks = this.getPrimaryKeyFields(meta);
35
- if (pks.length === 1) {
36
- res.row ??= {};
37
- res.rows ??= [];
38
- res.insertId = res.insertId || res.row[pks[0]];
39
- }
34
+ this.resolveInsertedPrimaryKeys(meta, data, res);
40
35
  return res;
41
36
  }
42
37
  return super.nativeInsertMany(entityName, data, options, sql => {
43
38
  if (meta.hasTriggers) {
44
39
  // must match the OUTPUT columns of the parent implementation, which resolves STI children to the root
45
- const returning = this.getTableProps(meta.inheritanceType === 'tpt' ? meta : meta.root).filter(prop => prop.returning ||
46
- (((prop.persist !== false && prop.defaultRaw) || prop.autoincrement || prop.generated) &&
47
- (!(prop.name in data[0]) || isRaw(data[0][prop.name]))));
40
+ const returning = this.getInsertReturningProperties(meta.inheritanceType === 'tpt' ? meta : meta.root, data);
48
41
  sql = this.appendOutputTable(entityName, returning.flatMap(p => p.fieldNames), sql, sql.indexOf(' values '), options);
49
42
  }
50
43
  // For TPT children, the parent table owns the identity column.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mssql",
3
- "version": "7.2.7-dev.1",
3
+ "version": "7.2.7-dev.10",
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",
@@ -47,7 +47,7 @@
47
47
  "copy": "node ../../scripts/copy.mjs"
48
48
  },
49
49
  "dependencies": {
50
- "@mikro-orm/sql": "7.2.7-dev.1",
50
+ "@mikro-orm/sql": "7.2.7-dev.10",
51
51
  "kysely": "0.29.8",
52
52
  "tarn": "3.1.2",
53
53
  "tedious": "20.3.8",
@@ -57,7 +57,7 @@
57
57
  "@mikro-orm/core": "^7.2.6"
58
58
  },
59
59
  "peerDependencies": {
60
- "@mikro-orm/core": "7.2.7-dev.1"
60
+ "@mikro-orm/core": "7.2.7-dev.10"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">= 22.17.0"