@mikro-orm/sql 7.2.9-dev.13 → 7.2.9-dev.14
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/AbstractSqlDriver.js +10 -1
- package/package.json +2 -2
package/AbstractSqlDriver.js
CHANGED
|
@@ -1130,6 +1130,7 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
|
+
const scalarColumn = prop.fieldNames.length > 1 && !prop.polymorphic ? this.getScalarFieldName(prop) : undefined;
|
|
1133
1134
|
prop.fieldNames.forEach((fieldName, fieldNameIdx) => {
|
|
1134
1135
|
if (fields.has(fieldName) || (prop.ownColumns && !prop.ownColumns.includes(fieldName))) {
|
|
1135
1136
|
return;
|
|
@@ -1151,7 +1152,15 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
1151
1152
|
sql += '?';
|
|
1152
1153
|
}
|
|
1153
1154
|
params.push(...pks);
|
|
1154
|
-
|
|
1155
|
+
const value = data[idx][key];
|
|
1156
|
+
const scalar = Array.isArray(value) && value.length === 1 ? value[0] : value;
|
|
1157
|
+
// a composite FK given as a scalar holds only the target PK, written to the column that references it
|
|
1158
|
+
if (scalarColumn && !isRaw(scalar) && Utils.isPrimaryKey(scalar)) {
|
|
1159
|
+
addParams(prop, (fieldName === scalarColumn ? scalar : null));
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
addParams(prop, prop.fieldNames.length > 1 ? value?.[fieldNameIdx] : value);
|
|
1163
|
+
}
|
|
1155
1164
|
}
|
|
1156
1165
|
});
|
|
1157
1166
|
sql += ` else ${this.platform.quoteIdentifier(fieldName)} end, `;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.2.9-dev.
|
|
3
|
+
"version": "7.2.9-dev.14",
|
|
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.8"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.2.9-dev.
|
|
56
|
+
"@mikro-orm/core": "7.2.9-dev.14"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|