alfateam / orange-orm

The ultimate ORM for Node and Typescript
https://orange-orm.io
ISC License
623 stars 20 forks source link

[BUG]: Incorrect column alias on deeply nested many relation filter #76

Closed lroal closed 3 months ago

lroal commented 3 months ago

rdb Version

3.6.0

Database

SAP ASE

Database Version

16

Operating System

mcr.microsoft.com/vscode/devcontainers/javascript-node:0-20-bullseye

Description

Yields incorrect sql alias on column when relation filter on many relation is deep. It only works when first level of relation is many relation.

 const dokument = await db.dokument.getById(file_id, {
        dokument_mappe: { //one relation
            mappe: {
                deling: {
                    where: x => x.dfs_dok_tilgang_type_id.in([1,2]) //would only work if dokument_mappe is many relation as well
                }
            }
        }
    });

Expected Behavior

Produce correct column alias.