@mikro-orm/sql 7.2.2-dev.29 → 7.2.2-dev.30

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.
@@ -850,9 +850,13 @@ export class AbstractSqlDriver extends DatabaseDriver {
850
850
  props.forEach(prop => {
851
851
  // For STI with conflicting fieldNames, use discriminator to determine which field gets value
852
852
  if (prop.stiFieldNames && prop.stiFieldNameMap && meta.discriminatorColumn) {
853
- const activeField = prop.stiFieldNameMap[row[meta.discriminatorColumn]];
853
+ // the map misses subtypes whose props were not initialized yet during discovery (root column owner, grandchildren)
854
+ const discriminator = row[meta.discriminatorColumn];
855
+ const childClass = meta.discriminatorMap?.[discriminator];
856
+ const activeField = prop.stiFieldNameMap[discriminator] ??
857
+ (childClass && this.metadata.find(childClass)?.properties[prop.name]?.fieldNames[0]);
854
858
  for (const field of prop.stiFieldNames) {
855
- params.push(field === activeField ? row[prop.name] : null);
859
+ params.push(field === activeField ? (row[prop.name] ?? null) : null);
856
860
  keys.push('?');
857
861
  }
858
862
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.2.2-dev.29",
3
+ "version": "7.2.2-dev.30",
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.29"
56
+ "@mikro-orm/core": "7.2.2-dev.30"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"