1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Fixed #34841 -- Avoided rendering apps on state still requiring mutation.

This commit is contained in:
David Sanders 2023-09-15 04:04:50 +10:00 committed by Mariusz Felisiak
parent 1c11dba835
commit b6e2b83901

View File

@ -224,6 +224,9 @@ class MigrationExecutor:
# remaining applied migrations. # remaining applied migrations.
last_unapplied_migration = plan[-1][0] last_unapplied_migration = plan[-1][0]
state = states[last_unapplied_migration] state = states[last_unapplied_migration]
# Avoid mutating state with apps rendered as it's an expensive
# operation.
del state.apps
for index, (migration, _) in enumerate(full_plan): for index, (migration, _) in enumerate(full_plan):
if migration == last_unapplied_migration: if migration == last_unapplied_migration:
for migration, _ in full_plan[index:]: for migration, _ in full_plan[index:]: