@mikro-orm/knex 6.4.17-dev.10 → 6.4.17-dev.12
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.
|
@@ -204,7 +204,14 @@ class MySqlSchemaHelper extends SchemaHelper_1.SchemaHelper {
|
|
|
204
204
|
col.defaultTo(null);
|
|
205
205
|
}
|
|
206
206
|
else {
|
|
207
|
-
|
|
207
|
+
const columnType = column.type.toLowerCase();
|
|
208
|
+
// https://dev.mysql.com/doc/refman/9.0/en/data-type-defaults.html
|
|
209
|
+
const needsExpression = ['blob', 'text', 'json', 'point', 'linestring', 'polygon', 'multipoint', 'multilinestring', 'multipolygon', 'geometrycollection'].some(type => columnType.startsWith(type));
|
|
210
|
+
let defaultSql = needsExpression && !column.default.startsWith('(') ? `(${column.default})` : column.default;
|
|
211
|
+
if (column.extra) {
|
|
212
|
+
defaultSql += ' ' + column.extra;
|
|
213
|
+
}
|
|
214
|
+
col.defaultTo(knex.raw(defaultSql));
|
|
208
215
|
}
|
|
209
216
|
}
|
|
210
217
|
return col;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.4.17-dev.
|
|
3
|
+
"version": "6.4.17-dev.12",
|
|
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,7 +66,7 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.4.16"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.4.17-dev.
|
|
69
|
+
"@mikro-orm/core": "6.4.17-dev.12",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|
|
@@ -49,13 +49,14 @@ class CriteriaNodeFactory {
|
|
|
49
49
|
static createObjectItemNode(metadata, entityName, node, payload, key, meta) {
|
|
50
50
|
const prop = meta?.properties[key];
|
|
51
51
|
const childEntity = prop && prop.kind !== core_1.ReferenceKind.SCALAR ? prop.type : entityName;
|
|
52
|
-
|
|
52
|
+
const isNotEmbedded = prop?.kind !== core_1.ReferenceKind.EMBEDDED;
|
|
53
|
+
if (isNotEmbedded && prop?.customType instanceof core_1.JsonType) {
|
|
53
54
|
return this.createScalarNode(metadata, childEntity, payload[key], node, key);
|
|
54
55
|
}
|
|
55
56
|
if (prop?.kind === core_1.ReferenceKind.SCALAR && payload[key] != null && Object.keys(payload[key]).some(f => core_1.Utils.isGroupOperator(f))) {
|
|
56
57
|
throw core_1.ValidationError.cannotUseGroupOperatorsInsideScalars(entityName, prop.name, payload);
|
|
57
58
|
}
|
|
58
|
-
if (
|
|
59
|
+
if (isNotEmbedded) {
|
|
59
60
|
return this.createNode(metadata, childEntity, payload[key], node, key);
|
|
60
61
|
}
|
|
61
62
|
if (payload[key] == null) {
|