@mikro-orm/knex 5.9.5-dev.2 → 5.9.5
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 +8 -6
- package/package.json +5 -5
package/AbstractSqlDriver.js
CHANGED
|
@@ -173,19 +173,21 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
|
|
|
173
173
|
relationPojo[prop.name] = root[alias];
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
|
-
meta2.props
|
|
177
|
-
|
|
178
|
-
.forEach(prop => {
|
|
176
|
+
const props = meta2.props.filter(prop => this.platform.shouldHaveColumn(prop, p.children || []));
|
|
177
|
+
for (const prop of props) {
|
|
179
178
|
if (prop.fieldNames.length > 1) { // composite keys
|
|
180
179
|
relationPojo[prop.name] = prop.fieldNames.map(name => root[`${relationAlias}__${name}`]);
|
|
181
|
-
prop.fieldNames.map(name => delete root[`${relationAlias}__${name}`]);
|
|
182
180
|
}
|
|
183
181
|
else {
|
|
184
182
|
const alias = `${relationAlias}__${prop.fieldNames[0]}`;
|
|
185
183
|
relationPojo[prop.name] = root[alias];
|
|
186
|
-
delete root[alias];
|
|
187
184
|
}
|
|
188
|
-
}
|
|
185
|
+
}
|
|
186
|
+
// properties can be mapped to multiple places, e.g. when sharing a column in multiple FKs,
|
|
187
|
+
// so we need to delete them after everything is mapped from given level
|
|
188
|
+
for (const prop of props) {
|
|
189
|
+
prop.fieldNames.map(name => delete root[`${relationAlias}__${name}`]);
|
|
190
|
+
}
|
|
189
191
|
if ([core_1.ReferenceType.MANY_TO_MANY, core_1.ReferenceType.ONE_TO_MANY].includes(relation.reference)) {
|
|
190
192
|
result[relation.name] = result[relation.name] || [];
|
|
191
193
|
result[relation.name].push(relationPojo);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "5.9.5
|
|
3
|
+
"version": "5.9.5",
|
|
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
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"sqlstring": "2.3.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^5.9.
|
|
66
|
+
"@mikro-orm/core": "^5.9.5"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "5.
|
|
70
|
-
"@mikro-orm/entity-generator": "5.
|
|
71
|
-
"@mikro-orm/migrations": "5.
|
|
69
|
+
"@mikro-orm/core": "^5.0.0",
|
|
70
|
+
"@mikro-orm/entity-generator": "^5.0.0",
|
|
71
|
+
"@mikro-orm/migrations": "^5.0.0",
|
|
72
72
|
"better-sqlite3": "*",
|
|
73
73
|
"mssql": "*",
|
|
74
74
|
"mysql": "*",
|