Fix one-to-many

This commit is contained in:
Adria Navarro 2024-10-16 14:05:48 +02:00
parent a476da08fa
commit 3ea8e240e4
1 changed files with 6 additions and 4 deletions

View File

@ -518,10 +518,12 @@ class InternalBuilder {
mainKnex.raw(this.quotedIdentifier(foreignKey))
)
query = query.whereExists(whereCb(updatedKey, subQuery))
if (allowEmptyRelationships) {
query = query.orWhereNull(foreignKey)
}
query = query.where(q => {
q.whereExists(whereCb(updatedKey, subQuery))
if (allowEmptyRelationships) {
q.orWhereNull(foreignKey)
}
})
}
}
}