Fix schema and aliasing usage

This commit is contained in:
Adria Navarro 2024-04-18 16:40:43 +02:00
parent dafa20ce47
commit 642f30416a
1 changed files with 7 additions and 8 deletions

View File

@ -472,14 +472,13 @@ class InternalBuilder {
): Knex.QueryBuilder {
const tableName = endpoint.entityId
const tableAlias = aliases?.[tableName]
let table: string | Record<string, string> = tableName
if (tableAlias) {
table = { [tableAlias]: tableName }
}
let query = knex(table)
if (endpoint.schema) {
query = query.withSchema(endpoint.schema)
}
const query = knex(
this.tableNameWithSchema(tableName, {
alias: tableAlias,
schema: endpoint.schema,
})
)
return query
}