@mikro-orm/knex 6.0.0-dev.180 → 6.0.0-dev.182
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/schema/DatabaseTable.js +5 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.182",
|
|
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",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@mikro-orm/core": "^5.9.2"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.0.0-dev.
|
|
69
|
+
"@mikro-orm/core": "6.0.0-dev.182"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/schema/DatabaseTable.js
CHANGED
|
@@ -162,7 +162,9 @@ class DatabaseTable {
|
|
|
162
162
|
&& (index.columnNames.length > 1 // All composite indexes are to be mapped to entity decorators or FK props.
|
|
163
163
|
|| !(index.columnNames[0] in columnFks) // Non-composite indexes for scalar props are to be mapped to the column.
|
|
164
164
|
|| skippedColumnNames.includes(index.columnNames[0]) // Non-composite indexes for skipped columns are to be mapped as entity decorators.
|
|
165
|
-
)
|
|
165
|
+
)
|
|
166
|
+
// ignore indexes that don't have all column names (this can happen in sqlite where there is no way to infer this for expressions)
|
|
167
|
+
&& !index.columnNames.some(col => col === null));
|
|
166
168
|
for (const index of potentiallyUnmappedIndexes) {
|
|
167
169
|
const ret = { name: index.keyName };
|
|
168
170
|
// Index is for FK. Map to the FK prop and move on.
|
|
@@ -375,9 +377,7 @@ class DatabaseTable {
|
|
|
375
377
|
// If the prop named after the column has a FK and the FK's columns are a subset of this index,
|
|
376
378
|
// include this prop and move on.
|
|
377
379
|
const columnPropFk = fksOnColumnProps.get(columnName);
|
|
378
|
-
if (columnPropFk && !columnPropFk.columnNames.some(fkColumnName => {
|
|
379
|
-
return !columnNames.includes(fkColumnName);
|
|
380
|
-
})) {
|
|
380
|
+
if (columnPropFk && !columnPropFk.columnNames.some(fkColumnName => !columnNames.includes(fkColumnName))) {
|
|
381
381
|
propBaseNames.add(columnName);
|
|
382
382
|
continue;
|
|
383
383
|
}
|
|
@@ -389,9 +389,7 @@ class DatabaseTable {
|
|
|
389
389
|
if (!columnFks[columnName].includes(fk)) {
|
|
390
390
|
continue;
|
|
391
391
|
}
|
|
392
|
-
if (!fk.columnNames.some(fkColumnName => {
|
|
393
|
-
return !columnNames.includes(fkColumnName);
|
|
394
|
-
})) {
|
|
392
|
+
if (!fk.columnNames.some(fkColumnName => !columnNames.includes(fkColumnName))) {
|
|
395
393
|
propBaseNames.add(propName);
|
|
396
394
|
propAdded = true;
|
|
397
395
|
}
|