Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(hana): Support associations with static values #604

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hana/lib/HANAService.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ class HANAService extends SQLService {
let fkeys = x.element._foreignKeys
if (typeof fkeys === 'function') fkeys = fkeys.call(x.element)
fkeys.forEach(k => {
if (!k?.parentElement?.name) return // not all associations have foreign key references
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to add a test for this? At a first glimpse I'm not sure what this does

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests require changes to the associations.cds files from this PR: https://github.com/cap-js/cds-dbs/pull/601/files#diff-57b211a62e930494f7efc5c2da1f6e29973460905e495770d060b3fdba5f1e52

Once that is merged it is possible to add the tests case.

if (!parent.SELECT.columns.find(c => this.column_name(c) === k.parentElement.name)) {
parent.SELECT.columns.push({ ref: [parent.as, k.parentElement.name] })
}
Expand Down
Loading