corteza
corteza copied to clipboard
Number precision ignored when encoding number as column or alias
Is there an existing issue for this?
- [X] I have searched the existing issues
Version of Corteza
2023.9.2
Current Behavior
When creating a number field with precision 3 for example, and encoding it as a column and not JSON field, the column created in SQL Server database is always of default type decimal(18,0). That means 18 decimal digits are stored, but 0 precision digits (no digits after comma). This is what application uses to add a column:
ALTER TABLE "tableName" ADD "columnName" DECIMAL
Expected Behavior
The solution is to use type decimal(18,n), where n is precision specified in module field configuration in Corteza:
ALTER TABLE "tableName" ADD "columnName" DECIMAL(18,6)
Steps To Reproduce
- Create namespace
- Create module with numerical field, precision 3; store it as a column in MSSQL database
- Table is created with decimal(18,0) column, instead of decimal(18,3)
Environment and versions
Corteza 2023.9.2 Docker install
SQL Server 2019
Anything else?
No response
On a second thought, there may be a quick and dirty way to do this - just use 6 as precision value every time.
Stale issue message
No stale
Stale issue message