Add support for changing field types in ChangeField.

Review Request #12234 — Created April 8, 2022 and submitted

Information

Django Evolution
release-2.x

Reviewers

ChangeField now takes a field_type= option, which is used to change
the type of the field. If the database-specific types differ, then this
will go through the new BaseEvolutionOperations.change_column_type()
machinery to change the type of the field and, depending on the
database, any fields referencing it.

This is also supported when generating hinted evolutions. If the differ
sees that the type of a field has changed, it will generate a sample
ChangeField that changes the type and passes in all attributes (not
just those that would otherwise have changed) so that the backend can
generate a complete column definition.

Changes to fields that don't end up actually altering the type (such as
when two fields map to the same type at the database level) are treated
as a standard ChangeField operation, modifying any changed attributes.

Unit tests have been added for all database backends and for several
field type change scenarios.

All unit tests pass on all supported versions of Python, all versions of
Django, and various versions of all supported database backends.

Summary ID
Add support for changing field types in ChangeField.
`ChangeField` now takes a `field_type=` option, which is used to change the type of the field. If the database-specific types differ, then this will go through the new `BaseEvolutionOperations.change_column_type()` machinery to change the type of the field and, depending on the database, any fields referencing it. This is also supported when generating hinted evolutions. If the differ sees that the type of a field has changed, it will generate a sample `ChangeField` that changes the type and passes in all attributes (not just those that would otherwise have changed) so that the backend can generate a complete column definition. Changes to fields that don't end up actually altering the type (such as when two fields map to the same type at the database level) are treated as a standard `ChangeField` operation, modifying any changed attributes. Unit tests have been added for all database backends and for several field type change scenarios.
bb9d297fe2051338e0716c959d4901ef70b34b66
Description From Last Updated

F401 'unittest.SkipTest' imported but unused

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.x (ba37d8d)