Allow a DecimalField's max_digits and decimal_places to be changed.
Review Request #11309 — Created Nov. 29, 2020 and submitted
We didn't have any support for actually changing a
DecimalField
's
max_digits
anddecimal_places
attributes, which meant that once such
a field was added to a model, it could never be changed.This change implements the ability to change these attributes. It
requires a bit of a change to the column attribute mutation logic, since
unlike most attributes,max_digits
anddecimal_places
really need to
be considered together when updating the column. That's because in most
databases, they're defined as part of the column type
(numeric(max_digits, decimal_places)
). The approach implemented is a
bit specialized forDecimalField
, but if we encounter more situations
like this in the future, we'll be able to build upon it.
Unit tests pass for all databases and all versions of Django.
Summary | ID |
---|---|
5faedd53b6c40b05c9b13831d44b50126c3230ff |