ModelQuery: actually fix fields conflicts for jointures

ref: 68ff977bcc
This commit is contained in:
Alice Gaudon 2020-09-02 16:29:02 +02:00
parent 788be3dfa6
commit bffab3a4dc

View File

@ -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(',');