@mikro-orm/knex 6.6.15-dev.4 → 6.6.15-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.6.15-dev.4",
3
+ "version": "6.6.15-dev.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",
@@ -66,7 +66,7 @@
66
66
  "@mikro-orm/core": "^6.6.14"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.6.15-dev.4",
69
+ "@mikro-orm/core": "6.6.15-dev.5",
70
70
  "better-sqlite3": "*",
71
71
  "libsql": "*",
72
72
  "mariadb": "*"
@@ -38,7 +38,11 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
38
38
  throw new Error('Mixing collection operators with other filters is not allowed.');
39
39
  }
40
40
  const payload = this.payload[key].unwrap();
41
- const qb2 = qb.clone(true, ['_schema']);
41
+ // entities with a fixed schema must resolve the `from` table's own schema in the subquery,
42
+ // otherwise a nested operator inherits the root entity's schema (GH #7894); for wildcard or
43
+ // schema-less entities the schema is resolved dynamically and needs to be carried over
44
+ const fixedSchema = parentMeta.schema && parentMeta.schema !== '*';
45
+ const qb2 = qb.clone(true, fixedSchema ? undefined : ['_schema']);
42
46
  const sub = qb2
43
47
  .from(parentMeta.className)
44
48
  .innerJoin(this.key, qb2.getNextAlias(this.prop.type))