We are developing CAP Java application and in our entity definition(see below) we are using the @SAP/cds/common/#aspect-managed to auto-manage audit fields (createdBy, modifiedAt, modifiedBy, etc.).
Since managed aspect automatically add audit fields and these fields have already been deployed to SAP HANA, so they exist in the database BUT now we want to undeploy certain fields (e.g., createdBy, modifiedAt, modifiedBy) while keeping createdAt?
What is the best way to undeploy specific fields from table?
Entity definition:
using { managed } from '@sap/cds/common';
entity CustomerContracts : managed {
key owner : Association to CustomersAssigned;
};
Current Approach:
using db/undeploy.json, can someone help if this is the right approach to undeploy from CustomerContracts table?
"src/gen/landscape.CustomerContracts.createdBy.<it should be column not table>",
"src/gen/landscape.CustomerContracts.modifiedAt.<it should be column not table >",
"src/gen/andscape.CustomerContracts.modifiedBy.<it should be column not table>"
with this approach, I expect that all above fields should be undeployed from DB CustomerContracts table and keep others.
In service definition we make sure to expose createdAt e.g.,
entity CustomerContracts as projection on landscape.CustomerContracts {
owner,
createdAt
};
However, projection ensures that only targeting fields are exposed but will not delete other fields from db.
Expected output:
{
"owner_ID": "12345",
"createdAt": "2025-04-11T08:59:31.063725Z"
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.