Conversion to Decimal Issue

0
In one of my apps, we just encountered an issue with converting Float Attributes to Decimal. I just reproduced the issue in a small test project. The scenario is as follows: I have an app which points to a database called TestDB (database is Postgres) This app has an entity with a Float attribute, called Quantity This app has Main Line and one branch called TestBranch I start Main Line and add some objects to my entity with values for Quantity In TestBranch, I change attribute Quantity to Decimal type I run TestBranch using database TestDB, Quantity has the values I entered while running Main Line Now I discover an unrelated problem with TestBranch and decide to redeploy Main Line After running Main Line (using the same database, TestDB), the values of attribute Quantity are all 0.00 If this happens on my development environment, no problem, I just create a new database and begin working again. However, if this is my Production instance in the cloud, it presents a problem, because I may lose a lot of data. Is this expected behavior? Is this scenario described in documentation that I missed? Or did I do something wrong?
asked
3 answers
1

Conversion from decimal to float is not supported, please check documentation here: Effects of data type changes on existing attributes

answered
1

In my opinion you did something wrong. Because what you are really doing is after the upgrade of the database (float becomes decimal) you are trying to downgrade the database again (so decimal becomes float again). In my opinion this would be a mistake of the developer. Once you upgrade the database you should consider that state the as is state. Any changes should be done on that database. Or if you really made a mistake you should restore the database to the point before the upgrade.

Regards,

Ronald

answered
0

I agree with Ronald. It is highly not suggested to connect to the same database using different branches. This would definitely be a mistake.

All the possible scenarios cannot be handled well by Mendix. We, as developers, just need to be aware of the consequences of our actions. :)

Regards, Sharad

answered