From ef2830d36a0b1738835215bc1df563af2c68a7ac Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Tue, 6 May 2025 17:16:52 +0300 Subject: [PATCH] Fix duplicate detection by using UUID in migration script The migration script now counts duplicates based on the "uuid" field instead of "id". This ensures more accurate identification of duplicate "human_readable_id" entries. --- core/migrations/0018_alter_order_human_readable_id.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/migrations/0018_alter_order_human_readable_id.py b/core/migrations/0018_alter_order_human_readable_id.py index af9a1d8b..5e3bd33f 100644 --- a/core/migrations/0018_alter_order_human_readable_id.py +++ b/core/migrations/0018_alter_order_human_readable_id.py @@ -8,7 +8,7 @@ def fix_duplicates(apps, schema_editor): Order = apps.get_model("core", "Order") duplicates = ( Order.objects.values("human_readable_id") - .annotate(count=Count("id")) + .annotate(count=Count("uuid")) .filter(count__gt=1) ) for duplicate in duplicates: