Informations
What is the current behavior?
Currently the float type of MySQL doesn't properly store a long integer value of a length over a certain amount and will round up or down depending on the length which could cause problems specifically when dealing with large numbers.
Steps to reproduce the problem
create an float type and enter a value such as 36028807496337770
What is the expected behavior?
Float values stored in the API should not round.
Suggested solutions
A new data type could be created within the admin panel for the Double
data type in MySQL or within Strapi-Bookshelf the following code:
case 'float':
case 'decimal':
type = attribute.type;
break;
case 'date':
could be changed to:
case 'float':
type = 'double';
break;
case 'decimal':
type = 'decimal';
break;
case 'date':
I have tested this locally and it does work as intended, if such a change is accepted I can create a pull request.
It's okay to create a PR for this. We have a better support on MongoDB so we should do the same on SQL databases.
Will do @Aurelsicoko I'll get one created and submitted in the next few minutes :)