cds-dbs
cds-dbs copied to clipboard
`defaultStringLength` ignored for PostgreSQL deployer
My project is using Strings of unspecified length, with the cds.cdsc.defaultStringLength set to 1000. This translates to NVARCHAR(1000) in HANA, but the CSN going to PostgreSQL does not mention the 1000 anymore so PostgreSQL fields are of standard length 255.
db/schema.cds:
entity IntegrationPackages {
key Id : UUID @Core.Computed;
Name : String;
Description : String;
ShortText : String(500);
}
package.json:
"cds": {
"requires": {
"db": {
"kind": "postgres"
}
},
"cdsc": {
"defaultStringLength": 1000
}
}
Output of cds compile db/schema.cds -2 sql --dialect hana: (correct)
CREATE TABLE IntegrationPackages (
Id NVARCHAR(36) NOT NULL,
Name NVARCHAR(1000),
Description NVARCHAR(1000),
"SHORTTEXT" NVARCHAR(500),
PRIMARY KEY(Id)
);
Output of cds compile db/schema.cds -2 sql --dialect postgres: (correct)
CREATE TABLE IntegrationPackages (
Id VARCHAR(36) NOT NULL,
Name VARCHAR(1000),
Description VARCHAR(1000),
ShortText VARCHAR(500),
PRIMARY KEY(Id)
);
Output of cds compile db/schema.cds -2 csn: (not correct)
{
definitions: {
IntegrationPackages: {
kind: 'entity',
elements: {
Id: {
'@Core.Computed': true,
key: true,
type: 'cds.UUID'
},
Name: {
type: 'cds.String'
},
Description: {
type: 'cds.String'
},
ShortText: {
type: 'cds.String',
length: 500
}
}
}
},
meta: {
creator: 'CDS Compiler v5.9.2',
flavor: 'inferred'
},
'$version': '2.0'
}
Is there a way to tell cds build --production to use SQL instead of CSN for the generated postgres-db-deployer payload?
| migrationtool | https://github.com/SAP/migration-tool-for-cloud-integration |
|---|---|
| @cap-js/asyncapi | 1.0.3 |
| @cap-js/cds-typer | 0.34.0 |
| @cap-js/cds-types | 0.10.0 |
| @cap-js/db-service | 1.20.0 |
| @cap-js/hana | 1.9.0 |
| @cap-js/openapi | 1.2.1 |
| @cap-js/postgres | 1.14.0 |
| @cap-js/sqlite | 1.11.0 |
| @sap/cds | 8.9.2 |
| @sap/cds-compiler | 5.9.2 |
| @sap/cds-dk | 8.9.3 |
| @sap/cds-dk (global) | 8.9.2 |
| @sap/cds-fiori | 1.4.1 |
| @sap/cds-foss | 5.0.1 |
| @sap/cds-mtxs | 2.7.2 |
| @sap/eslint-plugin-cds | 3.2.0 |
| Node.js | v22.14.0 |