@mikro-orm/knex 6.0.0-dev.12 → 6.0.0-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/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.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
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"sqlstring": "2.3.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^5.
|
|
66
|
+
"@mikro-orm/core": "^5.6.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "~6.0.0-dev.
|
|
69
|
+
"@mikro-orm/core": "~6.0.0-dev.13"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/query/QueryBuilder.js
CHANGED
|
@@ -669,7 +669,8 @@ class QueryBuilder {
|
|
|
669
669
|
}
|
|
670
670
|
if (data) {
|
|
671
671
|
if (core_1.Utils.isEntity(data)) {
|
|
672
|
-
data =
|
|
672
|
+
// data = helper(data).toJSON();
|
|
673
|
+
data = this.em?.getComparator().prepareEntity(data) ?? (0, core_1.serialize)(data);
|
|
673
674
|
}
|
|
674
675
|
this._data = this.helper.processData(data, this.flags.has(core_1.QueryFlag.CONVERT_CUSTOM_TYPES));
|
|
675
676
|
}
|
|
@@ -429,13 +429,13 @@ class QueryBuilderHelper {
|
|
|
429
429
|
ret.push(`${k} ${order.toLowerCase()}`);
|
|
430
430
|
return;
|
|
431
431
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
const prop = this.getProperty(
|
|
432
|
+
core_1.Utils.splitPrimaryKeys(k).forEach(f => {
|
|
433
|
+
// eslint-disable-next-line prefer-const
|
|
434
|
+
let [alias, field] = this.splitField(f, true);
|
|
435
|
+
alias = populate[alias] || alias;
|
|
436
|
+
const prop = this.getProperty(field, alias);
|
|
437
437
|
const noPrefix = (prop && prop.persist === false && !prop.formula) || QueryBuilderHelper.isCustomExpression(f);
|
|
438
|
-
const column = this.mapper(noPrefix ?
|
|
438
|
+
const column = this.mapper(noPrefix ? field : `${alias}.${field}`, type, undefined, null);
|
|
439
439
|
/* istanbul ignore next */
|
|
440
440
|
const rawColumn = core_1.Utils.isString(column) ? column.split('.').map(e => this.knex.ref(e)).join('.') : column;
|
|
441
441
|
const customOrder = prop?.customOrder;
|
|
@@ -425,8 +425,10 @@ class SchemaComparator {
|
|
|
425
425
|
return index1.primary === index2.primary && index1.unique === index2.unique;
|
|
426
426
|
}
|
|
427
427
|
diffCheck(check1, check2) {
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
// check constraint definition might be normalized by the driver,
|
|
429
|
+
// e.g. quotes might be added (https://github.com/mikro-orm/mikro-orm/issues/3827)
|
|
430
|
+
const simplify = (str) => str?.replace(/['"`()]/g, '').toLowerCase();
|
|
431
|
+
return simplify(check1.expression) !== simplify(check2.expression);
|
|
430
432
|
}
|
|
431
433
|
hasSameDefaultValue(from, to) {
|
|
432
434
|
if (from.default == null || from.default.toString().toLowerCase() === 'null' || from.default.toString().startsWith('nextval(')) {
|