@mikro-orm/sql 7.1.2-dev.11 → 7.1.2-dev.13
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 +4 -1
- package/package.json +2 -2
package/AbstractSqlDriver.js
CHANGED
|
@@ -510,8 +510,11 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
510
510
|
else if (prop.fieldNames.length > 1) {
|
|
511
511
|
// composite keys
|
|
512
512
|
const fk = prop.fieldNames.map(name => root[`${relationAlias}__${name}`]);
|
|
513
|
+
// `mapFlatCompositePrimaryKey` collapses to a scalar when the target PK is a single prop
|
|
514
|
+
// (e.g. a relation referencing a composite unique key on a single-PK target).
|
|
513
515
|
const pk = Utils.mapFlatCompositePrimaryKey(fk, prop);
|
|
514
|
-
|
|
516
|
+
const valid = Array.isArray(pk) ? pk.every(val => val != null) : pk != null;
|
|
517
|
+
relationPojo[prop.name] = valid ? pk : null;
|
|
515
518
|
}
|
|
516
519
|
else if (prop.runtimeType === 'Date') {
|
|
517
520
|
const alias = `${relationAlias}__${prop.fieldNames[0]}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.1.2-dev.
|
|
3
|
+
"version": "7.1.2-dev.13",
|
|
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.1.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.1.2-dev.
|
|
56
|
+
"@mikro-orm/core": "7.1.2-dev.13"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|