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

use database constraints #302

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions bookshop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"db": {
"kind": "sql"
}
},
"features": {
"assert_integrity": "db"
}
}
}
18 changes: 17 additions & 1 deletion bookshop/test/requests.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GET {{server}}/browse/$metadata
### ------------------------------------------------------------------------
# Browse Books as any user
GET {{server}}/browse/Books?
# &$select=title,stock
&$select=title,stock,author
# &$expand=currency
# &sap-language=de
{{me}}
Expand Down Expand Up @@ -62,6 +62,22 @@ Authorization: Basic alice:
"currency": { "code": "USD" }
}

### ------------------------------------------------------------------------
# Create book with invalid author ID -> will fail
POST {{server}}/admin/Books

Choose a reason for hiding this comment

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

Maybe we could also add an example of where a ON DELETE CASCADE deletes leftover children?

Content-Type: application/json;IEEE754Compatible=true
Authorization: Basic alice:

{
"ID": 34,
"title": "Let constraints do the magic",
"descr": "Database constraints are helpful little things that prevent messing up your data.",
"author": { "ID": 777 },
"genre": { "ID": 14 },
"stock": 4,
"price": "19.99",
"currency": { "code": "USD" }
}

### ------------------------------------------------------------------------
# Put image to books
Expand Down
7 changes: 6 additions & 1 deletion orders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
"dependencies": {
"@capire/common": "*",
"@sap/cds": "^5"
},
"cds": {
"features": {
"assert_integrity": "db"
}
}
}
}
Loading