summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sanders <shang.xiao.sanders@gmail.com>2023-09-15 04:04:50 +1000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-03-22 21:29:59 +0100
commitb6e2b83901d841cf4d2179f650d1e7dca7e90c16 (patch)
treef24f8602638a0c4c46549c90fb8c4e7716834cb4
parent1c11dba835fb15d7c026d6e8a57c96ed66089437 (diff)
Fixed #34841 -- Avoided rendering apps on state still requiring mutation.
-rw-r--r--django/db/migrations/executor.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/migrations/executor.py b/django/db/migrations/executor.py
index eb738cf457..13afa5988f 100644
--- a/django/db/migrations/executor.py
+++ b/django/db/migrations/executor.py
@@ -224,6 +224,9 @@ class MigrationExecutor:
# remaining applied migrations.
last_unapplied_migration = plan[-1][0]
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):
if migration == last_unapplied_migration:
for migration, _ in full_plan[index:]: