From 3cf1dd2237e231b8c1997c14bd30c578c17efac5 Mon Sep 17 00:00:00 2001 From: faucomte97 Date: Fri, 1 Mar 2024 00:14:01 +0000 Subject: [PATCH] fix: Improve migration 0090 (use select_related instead) --- game/migrations/0090_add_missing_model_solutions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game/migrations/0090_add_missing_model_solutions.py b/game/migrations/0090_add_missing_model_solutions.py index 1a2b53659..893916d74 100644 --- a/game/migrations/0090_add_missing_model_solutions.py +++ b/game/migrations/0090_add_missing_model_solutions.py @@ -54,7 +54,7 @@ def add_missing_model_solutions(apps: Apps, *args): ], score=10, finish_time__gte=datetime.datetime(2023, 3, 1, 00, 00, tzinfo=pytz.UTC), - ).prefetch_related("level") + ).select_related("level") LOGGER.info(f"Retrieved {attempts.count()} attempts.") @@ -131,7 +131,7 @@ def remove_new_model_solutions(apps: Apps, *args): ], score__gt=10, finish_time__gte=datetime.datetime(2023, 3, 1, 00, 00, tzinfo=pytz.UTC), - ).update(score=10) + ).select_related("level").update(score=10) class Migration(migrations.Migration):