From b1f09bd6e392c82e97de06a9aeb229b14b55e06a Mon Sep 17 00:00:00 2001 From: Eckart Liemke Date: Tue, 23 Jun 2026 11:00:03 +0200 Subject: [PATCH 1/3] add more hints how to set the database_id --- guides/multitenancy/index.md | 2 ++ guides/multitenancy/mtxs.md | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/guides/multitenancy/index.md b/guides/multitenancy/index.md index 6994ab476c..96fb29c38e 100644 --- a/guides/multitenancy/index.md +++ b/guides/multitenancy/index.md @@ -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). +This is only the default database ID. If you want to specify different database IDs per tenant, 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 cds/requires/cds.xt.DeploymentService/hdi/create/database_id configuration as an environment variable to the MTX service in _mta.yaml_: ```yaml{6-17} - name: bookshop-mtx diff --git a/guides/multitenancy/mtxs.md b/guides/multitenancy/mtxs.md index ce5efd6c78..808e9eee89 100644 --- a/guides/multitenancy/mtxs.md +++ b/guides/multitenancy/mtxs.md @@ -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: '', + } + } + } + }) + return next() + }) + }) +}) +``` ## Consumption ### Via Programmatic APIs From 9bb5a8a452aea2d71ffaee51ce903e8a498312b1 Mon Sep 17 00:00:00 2001 From: ecklie <52252271+ecklie@users.noreply.github.com> Date: Tue, 23 Jun 2026 13:20:24 +0200 Subject: [PATCH 2/3] Update index.md --- guides/multitenancy/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/multitenancy/index.md b/guides/multitenancy/index.md index 96fb29c38e..ff84da240f 100644 --- a/guides/multitenancy/index.md +++ b/guides/multitenancy/index.md @@ -838,7 +838,7 @@ 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). -This is only the default database ID. If you want to specify different database IDs per tenant, 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). +This is only 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 cds/requires/cds.xt.DeploymentService/hdi/create/database_id configuration as an environment variable to the MTX service in _mta.yaml_: ```yaml{6-17} From 51366c7f9ffb7e687fe60f3bea5388313df534f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Wed, 24 Jun 2026 09:54:42 +0200 Subject: [PATCH 3/3] Apply suggestion from @renejeglinsky --- guides/multitenancy/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/multitenancy/index.md b/guides/multitenancy/index.md index ff84da240f..882d7802a2 100644 --- a/guides/multitenancy/index.md +++ b/guides/multitenancy/index.md @@ -838,7 +838,7 @@ 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). -This is only 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). +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 cds/requires/cds.xt.DeploymentService/hdi/create/database_id configuration as an environment variable to the MTX service in _mta.yaml_: ```yaml{6-17}