@mikro-orm/knex 6.4.9-dev.2 → 6.4.9-dev.4

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.
@@ -442,7 +442,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
442
442
  else {
443
443
  const field = prop.fieldNames[0];
444
444
  if (!duplicates.includes(field) || !usedDups.includes(field)) {
445
- if (prop.customType && !prop.object && 'convertToDatabaseValueSQL' in prop.customType && !this.platform.isRaw(row[prop.name])) {
445
+ if (prop.customType && !prop.object && 'convertToDatabaseValueSQL' in prop.customType && row[prop.name] != null && !this.platform.isRaw(row[prop.name])) {
446
446
  keys.push(prop.customType.convertToDatabaseValueSQL('?', this.platform));
447
447
  }
448
448
  else {
@@ -593,7 +593,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
593
593
  if (key in data[idx]) {
594
594
  const pks = core_1.Utils.getOrderedPrimaryKeys(cond, meta);
595
595
  sql += ` when (${pkCond}) then `;
596
- if (prop.customType && !prop.object && 'convertToDatabaseValueSQL' in prop.customType && !this.platform.isRaw(data[idx][key])) {
596
+ if (prop.customType && !prop.object && 'convertToDatabaseValueSQL' in prop.customType && data[idx][prop.name] != null && !this.platform.isRaw(data[idx][key])) {
597
597
  sql += prop.customType.convertToDatabaseValueSQL('?', this.platform);
598
598
  }
599
599
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.4.9-dev.2",
3
+ "version": "6.4.9-dev.4",
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.8"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.4.9-dev.2",
69
+ "@mikro-orm/core": "6.4.9-dev.4",
70
70
  "better-sqlite3": "*",
71
71
  "libsql": "*",
72
72
  "mariadb": "*"
@@ -260,6 +260,10 @@ class QueryBuilderHelper {
260
260
  });
261
261
  return this.wrapQueryGroup(parts, key);
262
262
  }
263
+ const rawField = core_1.RawQueryFragment.getKnownFragment(key);
264
+ if (!rawField && !core_1.Utils.isOperator(key, false) && !this.isPrefixed(key)) {
265
+ key = `${alias}.${key}`;
266
+ }
263
267
  if (this.isSimpleRegExp(value)) {
264
268
  params.push(this.getRegExpParam(value));
265
269
  return `${this.knex.ref(this.mapper(key))} like ?`;
@@ -297,7 +301,6 @@ class QueryBuilderHelper {
297
301
  if (operator === '$exists') {
298
302
  value = null;
299
303
  }
300
- const rawField = core_1.RawQueryFragment.getKnownFragment(key);
301
304
  if (rawField) {
302
305
  let sql = rawField.sql.replaceAll(core_1.ALIAS_REPLACEMENT, alias);
303
306
  params.push(...rawField.params);