@mikro-orm/knex 5.8.11-dev.7 → 5.8.11-dev.8

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": "5.8.11-dev.7",
3
+ "version": "5.8.11-dev.8",
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,9 +66,9 @@
66
66
  "@mikro-orm/core": "^5.8.10"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "5.8.11-dev.7",
70
- "@mikro-orm/entity-generator": "5.8.11-dev.7",
71
- "@mikro-orm/migrations": "5.8.11-dev.7",
69
+ "@mikro-orm/core": "5.8.11-dev.8",
70
+ "@mikro-orm/entity-generator": "5.8.11-dev.8",
71
+ "@mikro-orm/migrations": "5.8.11-dev.8",
72
72
  "better-sqlite3": "*",
73
73
  "mssql": "*",
74
74
  "mysql": "*",
@@ -473,7 +473,8 @@ class QueryBuilder {
473
473
  if (cached?.data) {
474
474
  return cached.data;
475
475
  }
476
- const type = this.connectionType || (method === 'run' ? 'write' : 'read');
476
+ const write = method === 'run' || !this.platform.getConfig().get('preferReadReplicas');
477
+ const type = this.connectionType || (write ? 'write' : 'read');
477
478
  const res = await this.driver.getConnection(type).execute(query.sql, query.bindings, method, this.context);
478
479
  const meta = this.mainAlias.metadata;
479
480
  if (!options.mapResults || !meta) {