on 03-24-2023 7:44 PM
Hi Colleagues,
We have the below schema.cds
entity A {
key a1: String;
b: Composition of many B on b.b2 = $self;
}
entity B {
key b1: String;
key b2: Association to one A @assert.integrity;
}
But when we run cds compile schema.cds --to sql I do not see foreign key, also they are not present and enforced when checked after deployment to hana db. Any idea what might be going wrong?
CREATE TABLE com_sap_acrs_definereport_A (
a1 NVARCHAR(5000) NOT NULL,
PRIMARY KEY(a1)
);
CREATE TABLE com_sap_acrs_definereport_B (
b1 NVARCHAR(5000) NOT NULL,
b2_a1 NVARCHAR(5000) NOT NULL,
PRIMARY KEY(b1, b2_a1)
);
You explicitly need to enable generation of foreign key constraints on the database for your project in an additional global setting in your .cdsrc.json file.
{
...
"features": {
"assert_integrity": "db"
}
...
}
See section Database Constraints, which is also linked from the @assert.integrity documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
11 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.