I have a database with columns of string type with decimal values in them. Those decimals are longitudes and latitudes, so these numbers can be long of 8 units after the dot.
I want to convert the type from string to decimal. The problem is that when I assign decimal type in my schema.yml, it rounds the values to 2 units after the dot, and if I had a scale parameter of 12 and size of 16 (to be large), it rounds it to 2 units after the dot and adds 10 zeros at the end.
lat: { type: string(255), notnull: false }
to
lat: { type: decimal, scale: 12, size:16, notnull: false }
Is there a way to migrate these columns to decimal type without losing precision?
Do you really need a decimal?
Because regarding an old ticket on the Doctrine bug tracker, it seems better to use a
floatinstead of adecimalfor this kind of case.Give it a try.