1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #34366 -- Reduced AlterField operations when optimizing migrations.

This commit is contained in:
Laurent Tramoy
2023-02-24 13:48:46 +01:00
committed by Mariusz Felisiak
parent f9fe062de5
commit 2276ec8c21
2 changed files with 15 additions and 9 deletions

View File

@@ -247,9 +247,9 @@ class AlterField(FieldOperation):
return "alter_%s_%s" % (self.model_name_lower, self.name_lower)
def reduce(self, operation, app_label):
if isinstance(operation, RemoveField) and self.is_same_field_operation(
operation
):
if isinstance(
operation, (AlterField, RemoveField)
) and self.is_same_field_operation(operation):
return [operation]
elif (
isinstance(operation, RenameField)