@mikro-orm/knex 6.0.0-dev.87 → 6.0.0-dev.89

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.
@@ -547,12 +547,13 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
547
547
  if (owners.length === 1 && (options?.offset != null || options?.limit != null)) {
548
548
  qb.limit(options.limit, options.offset);
549
549
  }
550
+ const schema = this.config.get('schema');
550
551
  if (prop.targetMeta.schema !== '*' && pivotMeta.schema === '*' && options?.schema) {
551
552
  // eslint-disable-next-line dot-notation
552
553
  qb['finalize']();
553
554
  // eslint-disable-next-line dot-notation
554
555
  Object.values(qb['_joins']).forEach(join => {
555
- join.schema = options.schema;
556
+ join.schema = schema;
556
557
  });
557
558
  }
558
559
  const items = owners.length ? await this.rethrow(qb.execute('all')) : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.0.0-dev.87",
3
+ "version": "6.0.0-dev.89",
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.7.12"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "~6.0.0-dev.87"
69
+ "@mikro-orm/core": "~6.0.0-dev.89"
70
70
  }
71
71
  }
@@ -529,7 +529,7 @@ class QueryBuilder {
529
529
  res = await this.execute('get', false);
530
530
  }
531
531
  else {
532
- const qb = this.clone();
532
+ const qb = this.type === undefined ? this : this.clone();
533
533
  qb.count(field, distinct ?? qb.hasToManyJoins()).limit(undefined).offset(undefined).orderBy([]);
534
534
  res = await qb.execute('get', false);
535
535
  }