Don't include unnecessary joins
This commit is contained in:
parent
631317e6f0
commit
da92c3bb05
|
@ -1239,6 +1239,12 @@ class InternalBuilder {
|
||||||
if (!toTable || !fromTable) {
|
if (!toTable || !fromTable) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't include if not required
|
||||||
|
if (relationship.from && !fields.find(f => f === relationship.from)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
const relatedTable = tables[toTable]
|
const relatedTable = tables[toTable]
|
||||||
if (!relatedTable) {
|
if (!relatedTable) {
|
||||||
throw new Error(`related table "${toTable}" not found in datasource`)
|
throw new Error(`related table "${toTable}" not found in datasource`)
|
||||||
|
|
Loading…
Reference in New Issue