-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: dont use virtual key for
UPDATE … where (<key>) in <subquery>
(#…
…800) For a draft enabled model: ```cds namespace my; entity Books { key ID : Integer; title : String; stock : Integer; author : Association to Authors; } entity Authors { key ID : Integer; name : String; alive : Boolean; } service CatalogService { @odata.draft.enabled @readonly entity Books as projection on my.Books; @readonly entity Authors as projection on my.Authors; } ``` `my.Books` will have a field: ```json "IsActiveEntity": { "type": "cds.Boolean", "key": true, "default": { "val": true }, "@UI.Hidden": true }, ``` which is **marked as virtual by the lean draft implementation**. This virtual key must not be part of the primary key matching which is done for a path expression in a `UPDATE.where`: https://github.com/cap-js/cds-dbs/blob/982b8b796da4b577c5641039d2036816209c0437/db-service/test/cqn4sql/UPDATE.test.js#L73-L97 TODO: - [x] test this
- Loading branch information
1 parent
99a12f3
commit d25af70
Showing
5 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// dont use virtual key `isActiveEntity` in `UPDATE … where (<key>) in <subquery>` | ||
// in case of path expressions | ||
namespace bookshop; | ||
|
||
entity Books { | ||
key ID : Integer; | ||
title : String; | ||
stock : Integer; | ||
author : Association to Authors; | ||
} | ||
|
||
entity Authors { | ||
key ID : Integer; | ||
name : String; | ||
alive : Boolean; | ||
} | ||
|
||
service CatalogService { | ||
@odata.draft.enabled | ||
entity Books as projection on bookshop.Books; | ||
|
||
entity Authors as projection on bookshop.Authors; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
using { sap.capire.bookshop as my } from '../db/schema'; | ||
service DraftService { | ||
@odata.draft.enabled | ||
entity DraftEnabledBooks | ||
{ | ||
key ID : Integer; | ||
title : String; | ||
} | ||
} | ||
|
||
@odata.draft.enabled | ||
entity MoreDraftEnabledBooks as projection on my.Books; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters