From 2831b0493b3f048e286b0359b2b688c4e3d25def Mon Sep 17 00:00:00 2001 From: zakhy Date: Thu, 5 Jun 2025 17:00:37 +0700 Subject: [PATCH] recreate index --- .../migrations/0013_auto_20250605_1700.py | 45 +++++++++++++++++++ .../models/workers_locations.py | 4 +- .../models/workers_tracking.py | 4 +- 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 apps/workerslocation/migrations/0013_auto_20250605_1700.py diff --git a/apps/workerslocation/migrations/0013_auto_20250605_1700.py b/apps/workerslocation/migrations/0013_auto_20250605_1700.py new file mode 100644 index 0000000..62d6fd5 --- /dev/null +++ b/apps/workerslocation/migrations/0013_auto_20250605_1700.py @@ -0,0 +1,45 @@ +# Generated by Django 3.2.25 on 2025-06-05 17:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workerslocation', '0012_auto_20250605_1627'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='workerslocation', + name='workersloca_update__0a4688_idx', + ), + migrations.RemoveIndex( + model_name='workerslocation', + name='workersloca_active_c3b753_idx', + ), + migrations.RemoveIndex( + model_name='workerstracking', + name='workersloca_time_9a1c92_idx', + ), + migrations.RemoveIndex( + model_name='workerstracking', + name='workersloca_worker__f6ee2a_idx', + ), + migrations.AddIndex( + model_name='workerslocation', + index=models.Index(fields=['-update_time'], name='workersloca_update__16350c_idx'), + ), + migrations.AddIndex( + model_name='workerslocation', + index=models.Index(fields=['active', '-update_time'], name='workersloca_active_991295_idx'), + ), + migrations.AddIndex( + model_name='workerstracking', + index=models.Index(fields=['worker', '-time'], name='workersloca_worker__c2007b_idx'), + ), + migrations.AddIndex( + model_name='workerstracking', + index=models.Index(fields=['-time'], name='workersloca_time_4b870c_idx'), + ), + ] diff --git a/apps/workerslocation/models/workers_locations.py b/apps/workerslocation/models/workers_locations.py index 49c95e5..2e6edf3 100644 --- a/apps/workerslocation/models/workers_locations.py +++ b/apps/workerslocation/models/workers_locations.py @@ -85,6 +85,6 @@ class WorkersLocation(models.Model): indexes = [ models.Index(fields=["uid", ]), models.Index(fields=["name", ]), - models.Index(fields=["update_time", ]), - models.Index(fields=["active", "update_time", ]), + models.Index(fields=["-update_time", ]), + models.Index(fields=["active", "-update_time", ]), ] diff --git a/apps/workerslocation/models/workers_tracking.py b/apps/workerslocation/models/workers_tracking.py index 20cb74c..f45d779 100644 --- a/apps/workerslocation/models/workers_tracking.py +++ b/apps/workerslocation/models/workers_tracking.py @@ -59,6 +59,6 @@ class WorkersTracking(models.Model): # Передвижение персона verbose_name = "Передвижение сотрудника" verbose_name_plural = "Передвижения сотрудников" indexes = [ - models.Index(fields=["worker", "time"]), - models.Index(fields=["time",]), + models.Index(fields=["worker", "-time"]), + models.Index(fields=["-time",]), ]