Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix checkout line currency migration (#10542)

Filip Owczarekfe5a548f35a8
diff --git a/saleor/checkout/migrations/0051_auto_20220713_1103.py b/saleor/checkout/migrations/0051_auto_20220713_1103.py
index 61a97226b4..223ae443df 100644
--- a/saleor/checkout/migrations/0051_auto_20220713_1103.py
+++ b/saleor/checkout/migrations/0051_auto_20220713_1103.py
@@ -39,7 +39,9 @@ def set_default_checkout_line_currency(apps, schema_editor):
Checkout = apps.get_model("checkout", "Checkout")
CheckoutLine = apps.get_model("checkout", "CheckoutLine")
- for currency in Checkout.objects.values_list("currency", flat=True):
+ for currency in (
+ Checkout.objects.values_list("currency", flat=True).distinct().order_by()
+ ):
CheckoutLine.objects.filter(currency=None, checkout__currency=currency).update(
currency=currency
)