cds-dbs
cds-dbs copied to clipboard
chore: unify UPSERT implementation
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 specific undefined
check. With these special cases covered it is possible to generate INSERT
and UPSERT
statements that correctly apply default
, @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 of UPSERT
and the @sap/cds/common.cds
use the @cds.on.insert
annotations. Which with the current UPSERT
implementation could possibly be null
which should be impossible as every entry in the database has to have been inserted once.