@mikro-orm/knex 6.0.0-dev.83 → 6.0.0-dev.84

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.
@@ -32,6 +32,7 @@ export declare abstract class AbstractSqlDriver<Connection extends AbstractSqlCo
32
32
  nativeDelete<T extends object>(entityName: string, where: FilterQuery<T> | string | any, options?: DeleteOptions<T>): Promise<QueryResult<T>>;
33
33
  syncCollection<T extends object, O extends object>(coll: Collection<T, O>, options?: DriverMethodOptions): Promise<void>;
34
34
  loadFromPivotTable<T extends object, O extends object>(prop: EntityProperty, owners: Primary<O>[][], where?: FilterQuery<any>, orderBy?: OrderDefinition<T>, ctx?: Transaction, options?: FindOptions<T, any, any>): Promise<Dictionary<T[]>>;
35
+ private getPivotOrderBy;
35
36
  execute<T extends QueryResult | EntityData<AnyEntity> | EntityData<AnyEntity>[] = EntityData<AnyEntity>[]>(queryOrKnex: string | Knex.QueryBuilder | Knex.Raw, params?: any[], method?: 'all' | 'get' | 'run', ctx?: Transaction): Promise<T>;
36
37
  /**
37
38
  * 1:1 owner side needs to be marked for population so QB auto-joins the owner id
@@ -512,9 +512,15 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
512
512
  }
513
513
  async loadFromPivotTable(prop, owners, where = {}, orderBy, ctx, options) {
514
514
  const pivotProp2 = this.getPivotInverseProperty(prop);
515
+ const prop2 = prop.targetMeta.properties[prop.mappedBy ?? prop.inversedBy];
515
516
  const ownerMeta = this.metadata.find(pivotProp2.type);
516
517
  const pivotMeta = this.metadata.find(prop.pivotEntity);
517
- const cond = { [`${prop.pivotEntity}.${pivotProp2.name}`]: { $in: ownerMeta.compositePK ? owners : owners.map(o => o[0]) } };
518
+ const qb = this.createQueryBuilder(prop.type, ctx, options?.connectionType).withSchema(this.getSchemaName(prop.targetMeta, options));
519
+ const pivotAlias = qb.getNextAlias(pivotMeta.tableName);
520
+ const pivotKey = pivotProp2.joinColumns.map(column => `${pivotAlias}.${column}`).join(core_1.Utils.PK_SEPARATOR);
521
+ const cond = {
522
+ [pivotKey]: { $in: ownerMeta.compositePK ? owners : owners.map(o => o[0]) },
523
+ };
518
524
  /* istanbul ignore if */
519
525
  if (!core_1.Utils.isEmpty(where) && Object.keys(where).every(k => core_1.Utils.isOperator(k, false))) {
520
526
  where = cond;
@@ -522,13 +528,22 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
522
528
  else {
523
529
  where = { ...where, ...cond };
524
530
  }
525
- orderBy = this.getPivotOrderBy(prop, orderBy);
526
- const qb = this.createQueryBuilder(prop.type, ctx, options?.connectionType)
527
- .unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES)
528
- .withSchema(this.getSchemaName(prop.targetMeta, options));
529
- const populate = this.autoJoinOneToOneOwner(prop.targetMeta, [{ field: prop.pivotEntity }]);
531
+ orderBy = this.getPivotOrderBy(prop, pivotAlias, orderBy);
532
+ const populate = this.autoJoinOneToOneOwner(prop.targetMeta, []);
530
533
  const fields = this.buildFields(prop.targetMeta, (options?.populate ?? []), [], qb, options?.fields);
531
- qb.select(fields).populate(populate).where(where).orderBy(orderBy).setLockMode(options?.lockMode, options?.lockTableAliases);
534
+ const k1 = !prop.owner ? 'joinColumns' : 'inverseJoinColumns';
535
+ const k2 = prop.owner ? 'joinColumns' : 'inverseJoinColumns';
536
+ const cols = [
537
+ ...prop[k1].map(col => `${pivotAlias}.${col} as fk__${col}`),
538
+ ...prop[k2].map(col => `${pivotAlias}.${col} as fk__${col}`),
539
+ ];
540
+ fields.push(...cols);
541
+ qb.select(fields)
542
+ .join(prop2.name, pivotAlias, {}, 'pivotJoin', undefined, options?.schema)
543
+ .populate(populate)
544
+ .where(where)
545
+ .orderBy(orderBy)
546
+ .setLockMode(options?.lockMode, options?.lockTableAliases);
532
547
  if (owners.length === 1 && (options?.offset != null || options?.limit != null)) {
533
548
  qb.limit(options.limit, options.offset);
534
549
  }
@@ -561,6 +576,18 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
561
576
  });
562
577
  return map;
563
578
  }
579
+ getPivotOrderBy(prop, pivotAlias, orderBy) {
580
+ if (!core_1.Utils.isEmpty(orderBy)) {
581
+ return orderBy;
582
+ }
583
+ if (!core_1.Utils.isEmpty(prop.orderBy)) {
584
+ return core_1.Utils.asArray(prop.orderBy);
585
+ }
586
+ if (prop.fixedOrder) {
587
+ return [{ [`${pivotAlias}.${prop.fixedOrderColumn}`]: core_1.QueryOrder.ASC }];
588
+ }
589
+ return [];
590
+ }
564
591
  async execute(queryOrKnex, params = [], method = 'all', ctx) {
565
592
  return this.rethrow(this.connection.execute(queryOrKnex, params, method, ctx));
566
593
  }
@@ -707,9 +734,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
707
734
  deleteDiff = [];
708
735
  }
709
736
  if (deleteDiff === true || deleteDiff.length > 0) {
710
- const qb1 = this.createQueryBuilder(prop.pivotEntity, options?.ctx, 'write')
711
- .withSchema(this.getSchemaName(meta, options))
712
- .unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES);
737
+ const qb1 = this.createQueryBuilder(prop.pivotEntity, options?.ctx, 'write').withSchema(this.getSchemaName(meta, options));
713
738
  const knex = qb1.getKnex();
714
739
  if (Array.isArray(deleteDiff)) {
715
740
  knex.whereIn(prop.inverseJoinColumns, deleteDiff);
@@ -737,7 +762,6 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
737
762
  else {
738
763
  await core_1.Utils.runSerial(items, item => {
739
764
  return this.createQueryBuilder(prop.pivotEntity, options?.ctx, 'write')
740
- .unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES)
741
765
  .withSchema(this.getSchemaName(meta, options))
742
766
  .insert(item)
743
767
  .execute('run', false);
@@ -746,7 +770,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
746
770
  }
747
771
  async lockPessimistic(entity, options) {
748
772
  const meta = (0, core_1.helper)(entity).__meta;
749
- const qb = this.createQueryBuilder(entity.constructor.name, options.ctx).unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES).withSchema(options.schema ?? meta.schema);
773
+ const qb = this.createQueryBuilder(entity.constructor.name, options.ctx).withSchema(options.schema ?? meta.schema);
750
774
  const cond = core_1.Utils.getPrimaryKeyCond(entity, meta.primaryKeys);
751
775
  qb.select((0, core_1.raw)('1')).where(cond).setLockMode(options.lockMode, options.lockTableAliases);
752
776
  await this.rethrow(qb.execute());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.0.0-dev.83",
3
+ "version": "6.0.0-dev.84",
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.10"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "~6.0.0-dev.83"
69
+ "@mikro-orm/core": "~6.0.0-dev.84"
70
70
  }
71
71
  }
@@ -91,11 +91,11 @@ export declare class QueryBuilder<T extends object = AnyEntity> {
91
91
  delete(cond?: QBFilterQuery): DeleteQueryBuilder<T>;
92
92
  truncate(): TruncateQueryBuilder<T>;
93
93
  count(field?: string | string[], distinct?: boolean): CountQueryBuilder<T>;
94
- join(field: string, alias: string, cond?: QBFilterQuery, type?: 'leftJoin' | 'innerJoin' | 'pivotJoin', path?: string): this;
95
- leftJoin(field: string, alias: string, cond?: QBFilterQuery): this;
96
- joinAndSelect(field: string, alias: string, cond?: QBFilterQuery, type?: 'leftJoin' | 'innerJoin' | 'pivotJoin', path?: string, fields?: string[]): SelectQueryBuilder<T>;
97
- leftJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[]): SelectQueryBuilder<T>;
98
- innerJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[]): SelectQueryBuilder<T>;
94
+ join(field: string, alias: string, cond?: QBFilterQuery, type?: 'leftJoin' | 'innerJoin' | 'pivotJoin', path?: string, schema?: string): this;
95
+ leftJoin(field: string, alias: string, cond?: QBFilterQuery, schema?: string): this;
96
+ joinAndSelect(field: string, alias: string, cond?: QBFilterQuery, type?: 'leftJoin' | 'innerJoin' | 'pivotJoin', path?: string, fields?: string[], schema?: string): SelectQueryBuilder<T>;
97
+ leftJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[], schema?: string): SelectQueryBuilder<T>;
98
+ innerJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[], schema?: string): SelectQueryBuilder<T>;
99
99
  protected getFieldsForJoinedLoad(prop: EntityProperty<T>, alias: string, explicitFields?: string[]): Field<T>[];
100
100
  withSubQuery(subQuery: Knex.QueryBuilder, alias: string): this;
101
101
  where(cond: QBFilterQuery<T>, operator?: keyof typeof GroupOperator): this;
@@ -209,7 +209,6 @@ export declare class QueryBuilder<T extends object = AnyEntity> {
209
209
  private hasToManyJoins;
210
210
  private wrapPaginateSubQuery;
211
211
  private wrapModifySubQuery;
212
- private autoJoinPivotTable;
213
212
  private getSchema;
214
213
  private createAlias;
215
214
  private createMainAlias;
@@ -137,18 +137,18 @@ class QueryBuilder {
137
137
  }
138
138
  return this.init(enums_1.QueryType.COUNT);
139
139
  }
140
- join(field, alias, cond = {}, type = 'innerJoin', path) {
141
- this.joinReference(field, alias, cond, type, path);
140
+ join(field, alias, cond = {}, type = 'innerJoin', path, schema) {
141
+ this.joinReference(field, alias, cond, type, path, schema);
142
142
  return this;
143
143
  }
144
- leftJoin(field, alias, cond = {}) {
145
- return this.join(field, alias, cond, 'leftJoin');
144
+ leftJoin(field, alias, cond = {}, schema) {
145
+ return this.join(field, alias, cond, 'leftJoin', undefined, schema);
146
146
  }
147
- joinAndSelect(field, alias, cond = {}, type = 'innerJoin', path, fields) {
147
+ joinAndSelect(field, alias, cond = {}, type = 'innerJoin', path, fields, schema) {
148
148
  if (!this.type) {
149
149
  this.select('*');
150
150
  }
151
- const prop = this.joinReference(field, alias, cond, type, path);
151
+ const prop = this.joinReference(field, alias, cond, type, path, schema);
152
152
  this.addSelect(this.getFieldsForJoinedLoad(prop, alias, fields));
153
153
  const [fromAlias] = this.helper.splitField(field);
154
154
  const populate = this._joinedProps.get(fromAlias);
@@ -162,11 +162,11 @@ class QueryBuilder {
162
162
  this._joinedProps.set(alias, item);
163
163
  return this;
164
164
  }
165
- leftJoinAndSelect(field, alias, cond = {}, fields) {
166
- return this.joinAndSelect(field, alias, cond, 'leftJoin', undefined, fields);
165
+ leftJoinAndSelect(field, alias, cond = {}, fields, schema) {
166
+ return this.joinAndSelect(field, alias, cond, 'leftJoin', undefined, fields, schema);
167
167
  }
168
- innerJoinAndSelect(field, alias, cond = {}, fields) {
169
- return this.joinAndSelect(field, alias, cond, 'innerJoin', undefined, fields);
168
+ innerJoinAndSelect(field, alias, cond = {}, fields, schema) {
169
+ return this.joinAndSelect(field, alias, cond, 'innerJoin', undefined, fields, schema);
170
170
  }
171
171
  getFieldsForJoinedLoad(prop, alias, explicitFields) {
172
172
  const fields = [];
@@ -614,7 +614,7 @@ class QueryBuilder {
614
614
  }
615
615
  return qb;
616
616
  }
617
- joinReference(field, alias, cond, type, path) {
617
+ joinReference(field, alias, cond, type, path, schema) {
618
618
  this.ensureNotFinalized();
619
619
  const [fromAlias, fromField] = this.helper.splitField(field);
620
620
  const q = (str) => `'${str}'`;
@@ -639,7 +639,7 @@ class QueryBuilder {
639
639
  let aliasedName = `${fromAlias}.${prop.name}#${alias}`;
640
640
  path ??= `${(Object.values(this._joins).find(j => j.alias === fromAlias)?.path ?? entityName)}.${prop.name}`;
641
641
  if (prop.kind === core_1.ReferenceKind.ONE_TO_MANY) {
642
- this._joins[aliasedName] = this.helper.joinOneToReference(prop, fromAlias, alias, type, cond);
642
+ this._joins[aliasedName] = this.helper.joinOneToReference(prop, fromAlias, alias, type, cond, schema);
643
643
  }
644
644
  else if (prop.kind === core_1.ReferenceKind.MANY_TO_MANY) {
645
645
  let pivotAlias = alias;
@@ -648,15 +648,15 @@ class QueryBuilder {
648
648
  pivotAlias = oldPivotAlias ?? this.getNextAlias(prop.pivotEntity);
649
649
  aliasedName = `${fromAlias}.${prop.name}#${pivotAlias}`;
650
650
  }
651
- const joins = this.helper.joinManyToManyReference(prop, fromAlias, alias, pivotAlias, type, cond, path);
651
+ const joins = this.helper.joinManyToManyReference(prop, fromAlias, alias, pivotAlias, type, cond, path, schema);
652
652
  Object.assign(this._joins, joins);
653
653
  this.createAlias(prop.pivotEntity, pivotAlias);
654
654
  }
655
655
  else if (prop.kind === core_1.ReferenceKind.ONE_TO_ONE) {
656
- this._joins[aliasedName] = this.helper.joinOneToReference(prop, fromAlias, alias, type, cond);
656
+ this._joins[aliasedName] = this.helper.joinOneToReference(prop, fromAlias, alias, type, cond, schema);
657
657
  }
658
658
  else { // MANY_TO_ONE
659
- this._joins[aliasedName] = this.helper.joinManyToOneReference(prop, fromAlias, alias, type, cond);
659
+ this._joins[aliasedName] = this.helper.joinManyToOneReference(prop, fromAlias, alias, type, cond, schema);
660
660
  }
661
661
  if (!this._joins[aliasedName].path && path) {
662
662
  this._joins[aliasedName].path = path;
@@ -839,10 +839,7 @@ class QueryBuilder {
839
839
  this._populateMap[join] = this._joins[join].alias;
840
840
  return;
841
841
  }
842
- if (this.metadata.find(field)?.pivotTable) { // pivot table entity
843
- this.autoJoinPivotTable(field);
844
- }
845
- else if (meta && this.helper.isOneToOneInverse(fromField)) {
842
+ if (meta && this.helper.isOneToOneInverse(fromField)) {
846
843
  const prop = meta.properties[fromField];
847
844
  const alias = this.getNextAlias(prop.pivotEntity ?? prop.type);
848
845
  const aliasedName = `${fromAlias}.${prop.name}#${alias}`;
@@ -982,17 +979,6 @@ class QueryBuilder {
982
979
  [core_1.Utils.getPrimaryKeyHash(meta.primaryKeys)]: { $in: subSubQuery },
983
980
  });
984
981
  }
985
- autoJoinPivotTable(field) {
986
- const pivotMeta = this.metadata.find(field);
987
- const owner = pivotMeta.relations[0];
988
- const inverse = pivotMeta.relations[1];
989
- const prop = this._cond[pivotMeta.name + '.' + owner.name] || this._orderBy[pivotMeta.name + '.' + owner.name] ? inverse : owner;
990
- const pivotAlias = this.getNextAlias(pivotMeta.name);
991
- this._joins[field] = this.helper.joinPivotTable(field, prop, this.mainAlias.aliasName, pivotAlias, 'leftJoin');
992
- core_1.Utils.renameKey(this._cond, `${field}.${owner.name}`, core_1.Utils.getPrimaryKeyHash(owner.fieldNames.map(fieldName => `${pivotAlias}.${fieldName}`)), true);
993
- core_1.Utils.renameKey(this._cond, `${field}.${inverse.name}`, core_1.Utils.getPrimaryKeyHash(inverse.fieldNames.map(fieldName => `${pivotAlias}.${fieldName}`)), true);
994
- this._populateMap[field] = this._joins[field].alias;
995
- }
996
982
  getSchema(alias) {
997
983
  const { metadata } = alias;
998
984
  const metaSchema = metadata?.schema && metadata.schema !== '*' ? metadata.schema : undefined;
@@ -1044,6 +1030,9 @@ class QueryBuilder {
1044
1030
  if (this._data) {
1045
1031
  object.data = this._data;
1046
1032
  }
1033
+ if (this._schema) {
1034
+ object.schema = this._schema;
1035
+ }
1047
1036
  if (!core_1.Utils.isEmpty(this._cond)) {
1048
1037
  object.where = this._cond;
1049
1038
  }
@@ -20,10 +20,9 @@ export declare class QueryBuilderHelper {
20
20
  mapper(field: string | Knex.Raw, type?: QueryType): string;
21
21
  mapper(field: string | Knex.Raw, type?: QueryType, value?: any, alias?: string | null): string;
22
22
  processData(data: Dictionary, convertCustomTypes: boolean, multi?: boolean): any;
23
- joinOneToReference(prop: EntityProperty, ownerAlias: string, alias: string, type: 'leftJoin' | 'innerJoin' | 'pivotJoin', cond?: Dictionary): JoinOptions;
24
- joinManyToOneReference(prop: EntityProperty, ownerAlias: string, alias: string, type: 'leftJoin' | 'innerJoin' | 'pivotJoin', cond?: Dictionary): JoinOptions;
25
- joinManyToManyReference(prop: EntityProperty, ownerAlias: string, alias: string, pivotAlias: string, type: 'leftJoin' | 'innerJoin' | 'pivotJoin', cond: Dictionary, path: string): Dictionary<JoinOptions>;
26
- joinPivotTable(field: string, prop: EntityProperty, ownerAlias: string, alias: string, type: 'leftJoin' | 'innerJoin' | 'pivotJoin', cond?: Dictionary): JoinOptions;
23
+ joinOneToReference(prop: EntityProperty, ownerAlias: string, alias: string, type: 'leftJoin' | 'innerJoin' | 'pivotJoin', cond?: Dictionary, schema?: string): JoinOptions;
24
+ joinManyToOneReference(prop: EntityProperty, ownerAlias: string, alias: string, type: 'leftJoin' | 'innerJoin' | 'pivotJoin', cond?: Dictionary, schema?: string): JoinOptions;
25
+ joinManyToManyReference(prop: EntityProperty, ownerAlias: string, alias: string, pivotAlias: string, type: 'leftJoin' | 'innerJoin' | 'pivotJoin', cond: Dictionary, path: string, schema?: string): Dictionary<JoinOptions>;
27
26
  processJoins(qb: Knex.QueryBuilder, joins: Dictionary<JoinOptions>, schema?: string): void;
28
27
  private processJoinClause;
29
28
  private wrapQueryGroup;
@@ -106,28 +106,28 @@ class QueryBuilderHelper {
106
106
  }
107
107
  return data;
108
108
  }
109
- joinOneToReference(prop, ownerAlias, alias, type, cond = {}) {
109
+ joinOneToReference(prop, ownerAlias, alias, type, cond = {}, schema) {
110
110
  const prop2 = prop.targetMeta.properties[prop.mappedBy || prop.inversedBy];
111
111
  const table = this.getTableName(prop.type);
112
- const schema = this.driver.getSchemaName(prop.targetMeta);
113
112
  const joinColumns = prop.owner ? prop.referencedColumnNames : prop2.joinColumns;
114
113
  const inverseJoinColumns = prop.referencedColumnNames;
115
114
  const primaryKeys = prop.owner ? prop.joinColumns : prop2.referencedColumnNames;
116
115
  return {
117
- prop, type, cond, ownerAlias, alias, table, schema,
116
+ prop, type, cond, ownerAlias, alias, table,
118
117
  joinColumns, inverseJoinColumns, primaryKeys,
118
+ schema: this.driver.getSchemaName(prop.targetMeta, { schema }),
119
119
  };
120
120
  }
121
- joinManyToOneReference(prop, ownerAlias, alias, type, cond = {}) {
121
+ joinManyToOneReference(prop, ownerAlias, alias, type, cond = {}, schema) {
122
122
  return {
123
123
  prop, type, cond, ownerAlias, alias,
124
124
  table: this.getTableName(prop.type),
125
- schema: this.driver.getSchemaName(prop.targetMeta),
125
+ schema: this.driver.getSchemaName(prop.targetMeta, { schema }),
126
126
  joinColumns: prop.referencedColumnNames,
127
127
  primaryKeys: prop.fieldNames,
128
128
  };
129
129
  }
130
- joinManyToManyReference(prop, ownerAlias, alias, pivotAlias, type, cond, path) {
130
+ joinManyToManyReference(prop, ownerAlias, alias, pivotAlias, type, cond, path, schema) {
131
131
  const pivotMeta = this.metadata.find(prop.pivotEntity);
132
132
  const ret = {
133
133
  [`${ownerAlias}.${prop.name}#${pivotAlias}`]: {
@@ -138,7 +138,7 @@ class QueryBuilderHelper {
138
138
  inverseJoinColumns: prop.inverseJoinColumns,
139
139
  primaryKeys: prop.referencedColumnNames,
140
140
  table: pivotMeta.tableName,
141
- schema: this.driver.getSchemaName(pivotMeta),
141
+ schema: this.driver.getSchemaName(pivotMeta, { schema }),
142
142
  path: path.endsWith('[pivot]') ? path : `${path}[pivot]`,
143
143
  },
144
144
  };
@@ -146,23 +146,10 @@ class QueryBuilderHelper {
146
146
  return ret;
147
147
  }
148
148
  const prop2 = prop.owner ? pivotMeta.relations[1] : pivotMeta.relations[0];
149
- ret[`${pivotAlias}.${prop2.name}#${alias}`] = this.joinManyToOneReference(prop2, pivotAlias, alias, type);
149
+ ret[`${pivotAlias}.${prop2.name}#${alias}`] = this.joinManyToOneReference(prop2, pivotAlias, alias, type, undefined, schema);
150
150
  ret[`${pivotAlias}.${prop2.name}#${alias}`].path = path;
151
151
  return ret;
152
152
  }
153
- joinPivotTable(field, prop, ownerAlias, alias, type, cond = {}) {
154
- const pivotMeta = this.metadata.find(field);
155
- const prop2 = pivotMeta.relations[0] === prop ? pivotMeta.relations[1] : pivotMeta.relations[0];
156
- return {
157
- prop, type, cond, ownerAlias, alias,
158
- inverseAlias: ownerAlias,
159
- table: pivotMeta.collection,
160
- schema: pivotMeta.schema,
161
- joinColumns: prop.joinColumns,
162
- inverseJoinColumns: prop2.joinColumns,
163
- primaryKeys: prop.referencedColumnNames,
164
- };
165
- }
166
153
  processJoins(qb, joins, schema) {
167
154
  Object.values(joins).forEach(join => {
168
155
  let table = `${join.table} as ${join.alias}`;