@mikro-orm/sql 7.2.9-dev.15 → 7.2.9-dev.17
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/package.json +2 -2
- package/query/QueryBuilderHelper.js +10 -6
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.17",
|
|
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.17"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|
|
@@ -415,14 +415,18 @@ export class QueryBuilderHelper {
|
|
|
415
415
|
Utils.runIfNotEmpty(() => {
|
|
416
416
|
let mergeParam = item.merge;
|
|
417
417
|
if (Utils.isObject(item.merge)) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const k = this.mapper(key, type);
|
|
421
|
-
mergeParam[k] = item.merge[key];
|
|
422
|
-
});
|
|
418
|
+
// same mapping as the insert data, so composite FK and polymorphic values are split across their columns
|
|
419
|
+
mergeParam = this.processData(item.merge, false);
|
|
423
420
|
}
|
|
424
421
|
if (Array.isArray(item.merge)) {
|
|
425
|
-
mergeParam = item.merge.
|
|
422
|
+
mergeParam = item.merge.flatMap(key => {
|
|
423
|
+
const [a, f] = typeof key === 'string' ? this.splitField(key) : [];
|
|
424
|
+
const prop = f ? this.getProperty(f, a) : undefined;
|
|
425
|
+
// a property name merges all columns of a composite FK, a column name merges just that column
|
|
426
|
+
return prop?.targetMeta && prop.fieldNames.length > 1 && !prop.fieldNames.includes(f)
|
|
427
|
+
? (prop.ownColumns ?? prop.fieldNames)
|
|
428
|
+
: [this.mapper(key, type)];
|
|
429
|
+
});
|
|
426
430
|
}
|
|
427
431
|
sub.merge = mergeParam ?? [];
|
|
428
432
|
// a merged row is updated, so its version is bumped as `updateVersionProperty()` does
|