Skip to content
Merged
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
2 changes: 2 additions & 0 deletions guides/multitenancy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,8 @@ If you start with a multitenant application that's configured to use to SAP HANA

For SAP HANA TMS v2, you also need to specify the database ID of the database that you plan to use for your tenant containers. You can specify this using the [`cds.xt.DeploymentService` configuration](/@external/guides/multitenancy/mtxs#deployment-config).

With `cds.xt.DeploymentService` you only configure the default database ID. If you want to specify different database IDs for a tenant HDI container, you need to [add the database ID to the payload of the individual subscription using a handler](/@external/guides/multitenancy/mtxs#example-handler-for-saasprovisioningservice).

To keep the application configuration agnostic, we recommend adding the <Config label="database_id" keyDelim="/">cds/requires/cds.xt.DeploymentService/hdi/create/database_id</Config> configuration as an environment variable to the MTX service in _mta.yaml_:
```yaml{6-17}
- name: bookshop-mtx
Expand Down
25 changes: 25 additions & 0 deletions guides/multitenancy/mtxs.md
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,31 @@ cds.on('served', ()=>{
For CLI usage via `cds subscribe|upgrade|unsubscribe` you can create a `mtx/sidecar/cli.js` file, which works analogously to a `server.js`.
:::

#### Example handler for SaasProvisioningService

A common usecase is the specification of an individual database ID per subscription.
```js
cds.on('served', async () => {
const {
'cds.xt.SaasProvisioningService': provisioning,
} = cds.services

await provisioning.prepend(() => {
provisioning.on('UPDATE', 'tenant', async (req, next) => {
req.data = cds.utils.merge(req?.data, {
_: {
hdi: {
create: {
database_id: '<database_id>',
}
}
}
})
return next()
})
})
})
```
## Consumption

### Via Programmatic APIs
Expand Down
Loading