-
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(deep): prevent false unique constraint errors and combine delete …
…queries (#781) ```cds entity Foo : cuid { name: String @asser.unique; } ``` existing: Foo( ID: 1, name: "foo" ) DELETE: Foo( ID: 3, name: "bar" ) <-- can never fail UPDATE: Foo( ID: 1, name: "bar" ) <-- can prevent fail INSERT: Foo( ID: 2, name: "foo" ) possible test: ```cds @odata.draft.enabled Books { key ID: Integer title: localized String; } ``` ```js UPDATE(Books, 42).data({ texts: [ {locale: 'en', title: 'abc'} {locale: 'de', title: 'abc'} ] }) ``` --------- Co-authored-by: Bob den Os <[email protected]>
- Loading branch information
1 parent
3bbde18
commit 01de95f
Showing
5 changed files
with
183 additions
and
83 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
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,14 @@ | ||
namespace complex.uniques; | ||
|
||
entity Books { | ||
key ID : Integer; | ||
title : String(111); | ||
pages : Composition of many Pages on pages.book = $self; | ||
} | ||
|
||
@assert.unique: { number: [number, book] } | ||
entity Pages { | ||
key ID : Integer; | ||
book : Association to Books; | ||
number : Integer; | ||
} |