-
Notifications
You must be signed in to change notification settings - Fork 11
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: properly support default
, cds.on.insert
and cds.on.update
for UPSERT
queries
#425
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's review that in one of our next syncs please ...
These are a lot of code changes all over the place, just to add support for defaults?
Particularly dislike, that we now seem to do quoting everywhere?
P.S. After the big cleanup we need extra discipline to keep it clean ;)
Hey @BobdenOs , is there any ETA on this PR? 💯 |
default
, cds.on.insert
and cds.on.update
for UPSERT
queries
🤖 I have created a release *beep* *boop* --- <details><summary>db-service: 1.14.1</summary> ## [1.14.1](db-service-v1.14.0...db-service-v1.14.1) (2024-10-28) ### Fixed * deep delete for views ([#496](#496)) ([82154ef](82154ef)) * properly support `default`, `cds.on.insert` and `cds.on.update` for `UPSERT` queries ([#425](#425)) ([338e9f5](338e9f5)) * SELECT cds.hana.BINARY ([#870](#870)) ([33c3ebe](33c3ebe)) </details> <details><summary>sqlite: 1.7.5</summary> ## [1.7.5](sqlite-v1.7.4...sqlite-v1.7.5) (2024-10-28) ### Fixed * properly support `default`, `cds.on.insert` and `cds.on.update` for `UPSERT` queries ([#425](#425)) ([338e9f5](338e9f5)) </details> <details><summary>postgres: 1.10.2</summary> ## [1.10.2](postgres-v1.10.1...postgres-v1.10.2) (2024-10-28) ### Fixed * properly support `default`, `cds.on.insert` and `cds.on.update` for `UPSERT` queries ([#425](#425)) ([338e9f5](338e9f5)) </details> <details><summary>hana: 1.4.0</summary> ## [1.4.0](hana-v1.3.2...hana-v1.4.0) (2024-10-28) ### Added * Improve procedure metadata lookup logic ([#862](#862)) ([da629d9](da629d9)) ### Fixed * enable `cesu8` by default for `hdb` driver and encode entries streams ([#868](#868)) ([d85d7e6](d85d7e6)) * Include `binary` type with `varbinary` type in `hana-client` ([#871](#871)) ([f4d7caf](f4d7caf)) * nested functions in comparisons ([#861](#861)) ([f3fd254](f3fd254)) * properly support `default`, `cds.on.insert` and `cds.on.update` for `UPSERT` queries ([#425](#425)) ([338e9f5](338e9f5)) * SELECT cds.hana.BINARY ([#870](#870)) ([33c3ebe](33c3ebe)) * Throw error if rows in limit is missing for expand, same as in limit() ([#858](#858)) ([641c3b9](641c3b9)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com>
This PR unifies the
UPSERT
implementation of all the database services. resulting in 2 helper functions in each database service that allow for defining the database specific JSON extraction logic and the database specificundefined
check. With these special cases covered it is possible to generateINSERT
andUPSERT
statements that correctly applydefault
,@cds.on.insert
and@cds.on.update
values. Which currently only apply to@cap-js/hana
and is a big blocker for most use cases ofUPSERT
and the@sap/cds/common.cds
use the@cds.on.insert
annotations. Which with the currentUPSERT
implementation could possibly benull
which should be impossible as every entry in the database has to have been inserted once.