ModelQuery: actually fix fields conflicts for jointures
ref: 68ff977bcc
This commit is contained in:
parent
788be3dfa6
commit
bffab3a4dc
@ -90,10 +90,10 @@ export default class ModelQuery<M extends Model> {
|
|||||||
public toString(final: boolean = false): string {
|
public toString(final: boolean = false): string {
|
||||||
let query = '';
|
let query = '';
|
||||||
|
|
||||||
if (this._pivot) {
|
// Prevent wildcard and fields from conflicting
|
||||||
this.fields = this.fields.map(f => this.table + '.' + f);
|
if (this._leftJoin) this.fields = this.fields.map(f => this.table + '.' + f);
|
||||||
this.fields.push(...this._pivot);
|
|
||||||
}
|
if (this._pivot) this.fields.push(...this._pivot);
|
||||||
|
|
||||||
let fields = this.fields.join(',');
|
let fields = this.fields.join(',');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user