I need to change a DecimalField
from having decimal_places=0
to decimal_places=7
while keeping max_digits=50
. I think all numbers in this column are between 0 and 1,000,000,000. So the data migration could be unproblematic. However, I'm uncertain.
I have seen the AlterField
documentation and I think I found the source code. However, I would need an introduction to this. Is it possible to see the generated SQL queries?
I could imagine several things going wrong:
- Data Dropping if
Decimal(decimal_places=0)
is different fromDecimal(decimal_places=7)
in a way that Django/Postgres does not take care of - Data Change if the internal representation stays the same but the values are interpreted in a different way
- Overflow if values get out of bounds
- NaN / NULL if values get out of bounds
The last two cases should not happen in my specific case, but I'm still interested how Django migrations would deal with out of bounds cases.