Description
In CDS 10, Decimal elements are mapped to the REAL affinity in SQLite instead of the previous NUMERIC affinity. SQLite's REAL affinity stores values as 8-byte IEEE 754 floating-point numbers, while NUMERIC affinity tried to store values as integers when possible. This change only affects local development and testing environments that use SQLite — production HANA deployments are not affected. Test assertions that relied on the precision or rounding behavior of NUMERIC affinity (e.g. exact decimal comparisons) may fail after the upgrade.
How to Check
- [ ] Check
cds envoutput forcds.requires.db.decimal_affinity— if absent, the newREALdefault applies for SQLite. - [ ] Search CDL files for
Decimalelement definitions to identify the scope of affected data. - [ ] Run the test suite against the upgraded environment and check for assertion failures on
Decimal-typed fields. - [ ] Review test assertions that compare
Decimalvalues with exact equality (e.g.expect(result.price).toBe(9.99)) — floating-point representation differences may cause failures.
Migration Steps
If the new
REALaffinity behavior is acceptable (most cases), no change is needed — the new default applies automatically. Verify by running the test suite.Update test assertions that relied on
NUMERICaffinity rounding behavior to be floating-point-tolerant:diff- expect(result.price).toBe(9.99); + expect(result.price).toBeCloseTo(9.99, 5);If you need time to update tests, temporarily set the compat flag to restore the previous
NUMERICaffinity:diff// package.json or .cdsrc.json { "cds": { "requires": { "db": { + "decimal_affinity": "NUMERIC" } } } }Remove the flag once test assertions are updated to handle
REALaffinity values.
Notes
The change only affects SQLite (local development and automated test runs). HANA Cloud stores Decimal with full precision regardless of this setting. Projects that run tests exclusively against HANA (e.g. in CI against a HANA service instance) are not affected by this change.