From 7912998c94581666754ba15f2d0d41f9f9719840 Mon Sep 17 00:00:00 2001 From: zakhy Date: Fri, 6 Jun 2025 11:04:23 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20#3=20(=D0=98=D0=BD=D0=B4=D0=B5=D0=BA=D1=81=D1=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gto/migrations/0023_auto_20250606_1100.py | 37 +++++++++ apps/gto/models/model_equipment.py | 7 +- apps/gto/models/model_tracking.py | 3 +- .../migrations/0015_auto_20250606_1100.py | 77 +++++++++++++++++++ .../migrations/0016_auto_20250606_1104.py | 29 +++++++ .../models/workers_locations.py | 10 +-- .../models/workers_tracking.py | 6 +- 7 files changed, 155 insertions(+), 14 deletions(-) create mode 100644 apps/gto/migrations/0023_auto_20250606_1100.py create mode 100644 apps/workerslocation/migrations/0015_auto_20250606_1100.py create mode 100644 apps/workerslocation/migrations/0016_auto_20250606_1104.py diff --git a/apps/gto/migrations/0023_auto_20250606_1100.py b/apps/gto/migrations/0023_auto_20250606_1100.py new file mode 100644 index 0000000..7578db8 --- /dev/null +++ b/apps/gto/migrations/0023_auto_20250606_1100.py @@ -0,0 +1,37 @@ +# Generated by Django 3.2.25 on 2025-06-06 11:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gto', '0022_auto_20250606_1015'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='equipment', + name='gto_equipme_time_91d62e_idx', + ), + migrations.RemoveIndex( + model_name='equipment', + name='gto_equipme_block_328df7_idx', + ), + migrations.RemoveIndex( + model_name='equipmenttracking', + name='gto_equipme_equipme_490e56_idx', + ), + migrations.RemoveIndex( + model_name='equipmenttracking', + name='gto_equipme_time_e9a7cd_idx', + ), + migrations.AddIndex( + model_name='equipment', + index=models.Index(fields=['time'], name='gto_equipme_time_f2ed8b_idx'), + ), + migrations.AddIndex( + model_name='equipmenttracking', + index=models.Index(fields=['time'], name='gto_equipme_time_ffb373_idx'), + ), + ] diff --git a/apps/gto/models/model_equipment.py b/apps/gto/models/model_equipment.py index 5978306..0d38b9c 100644 --- a/apps/gto/models/model_equipment.py +++ b/apps/gto/models/model_equipment.py @@ -107,9 +107,8 @@ class Equipment(models.Model): # Оборудование verbose_name = "объект" verbose_name_plural = "объекты" indexes = [ - models.Index(fields=["uid", ]), - models.Index(fields=["name", ]), - models.Index(fields=["-time", ]), - models.Index(fields=["block", "-time"]), + models.Index(fields=["uid"]), + models.Index(fields=["name"]), + models.Index(fields=["time"]), models.Index(fields=["block", "time"]), ] diff --git a/apps/gto/models/model_tracking.py b/apps/gto/models/model_tracking.py index adff235..02e01e6 100644 --- a/apps/gto/models/model_tracking.py +++ b/apps/gto/models/model_tracking.py @@ -63,7 +63,6 @@ class EquipmentTracking(models.Model): # Передвижение оборуд verbose_name_plural = "Передвижение оборудования" indexes = [ models.Index(fields=["eventid"]), - models.Index(fields=["equipment", "-time"]), - models.Index(fields=["-time"]), + models.Index(fields=["time"]), models.Index(fields=["equipment", "time"]), ] diff --git a/apps/workerslocation/migrations/0015_auto_20250606_1100.py b/apps/workerslocation/migrations/0015_auto_20250606_1100.py new file mode 100644 index 0000000..13169dd --- /dev/null +++ b/apps/workerslocation/migrations/0015_auto_20250606_1100.py @@ -0,0 +1,77 @@ +# Generated by Django 3.2.25 on 2025-06-06 11:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workerslocation', '0014_auto_20250606_0959'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='workerslocation', + name='uid_idx', + ), + migrations.RemoveIndex( + model_name='workerslocation', + name='name_idx', + ), + migrations.RemoveIndex( + model_name='workerslocation', + name='neg_update_time_idx', + ), + migrations.RemoveIndex( + model_name='workerslocation', + name='active_neg_update_time_idx', + ), + migrations.RemoveIndex( + model_name='workerslocation', + name='active_update_icon_idx', + ), + migrations.RemoveIndex( + model_name='workerstracking', + name='workersloca_worker__c2007b_idx', + ), + migrations.RemoveIndex( + model_name='workerstracking', + name='workersloca_time_4b870c_idx', + ), + migrations.RemoveIndex( + model_name='workerstracking', + name='worker_time_idx', + ), + migrations.AddIndex( + model_name='workerslocation', + index=models.Index(fields=['uid'], name='workersloca_uid_cbf84d_idx'), + ), + migrations.AddIndex( + model_name='workerslocation', + index=models.Index(fields=['name'], name='workersloca_name_cc95e1_idx'), + ), + migrations.AddIndex( + model_name='workerslocation', + index=models.Index(fields=['active'], name='workersloca_active_a8a207_idx'), + ), + migrations.AddIndex( + model_name='workerslocation', + index=models.Index(fields=['active', 'update_time'], name='workersloca_active_c3b753_idx'), + ), + migrations.AddIndex( + model_name='workerslocation', + index=models.Index(fields=['icon'], name='workersloca_icon_id_a97339_idx'), + ), + migrations.AddIndex( + model_name='workerstracking', + index=models.Index(fields=['worker'], name='workersloca_worker__d7aec1_idx'), + ), + migrations.AddIndex( + model_name='workerstracking', + index=models.Index(fields=['time'], name='workersloca_time_9a1c92_idx'), + ), + migrations.AddIndex( + model_name='workerstracking', + index=models.Index(fields=['worker', 'time'], name='workersloca_worker__f6ee2a_idx'), + ), + ] diff --git a/apps/workerslocation/migrations/0016_auto_20250606_1104.py b/apps/workerslocation/migrations/0016_auto_20250606_1104.py new file mode 100644 index 0000000..0cd2a3e --- /dev/null +++ b/apps/workerslocation/migrations/0016_auto_20250606_1104.py @@ -0,0 +1,29 @@ +# Generated by Django 3.2.25 on 2025-06-06 11:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workerslocation', '0015_auto_20250606_1100'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='workerslocation', + name='workersloca_active_c3b753_idx', + ), + migrations.RemoveIndex( + model_name='workerstracking', + name='workersloca_worker__f6ee2a_idx', + ), + migrations.AddIndex( + model_name='workerslocation', + index=models.Index(fields=['update_time', 'active'], name='workersloca_update__4a6860_idx'), + ), + migrations.AddIndex( + model_name='workerstracking', + index=models.Index(fields=['time', 'worker'], name='workersloca_time_83493b_idx'), + ), + ] diff --git a/apps/workerslocation/models/workers_locations.py b/apps/workerslocation/models/workers_locations.py index f5ed317..8d7cc4f 100644 --- a/apps/workerslocation/models/workers_locations.py +++ b/apps/workerslocation/models/workers_locations.py @@ -83,9 +83,9 @@ class WorkersLocation(models.Model): verbose_name = "объект" verbose_name_plural = "объекты" indexes = [ - models.Index(fields=["uid"], name="uid_idx"), - models.Index(fields=["name"], name="name_idx"), - models.Index(fields=["-update_time"], name="neg_update_time_idx"), - models.Index(fields=["active", "-update_time"], name="active_neg_update_time_idx"), - models.Index(fields=["active", "update_time", "icon"], name="active_update_icon_idx"), + models.Index(fields=["uid"]), + models.Index(fields=["name"]), + models.Index(fields=["active"]), + models.Index(fields=["update_time", "active"]), + models.Index(fields=["icon"]), ] diff --git a/apps/workerslocation/models/workers_tracking.py b/apps/workerslocation/models/workers_tracking.py index 080fc95..b262f4d 100644 --- a/apps/workerslocation/models/workers_tracking.py +++ b/apps/workerslocation/models/workers_tracking.py @@ -59,7 +59,7 @@ class WorkersTracking(models.Model): # Передвижение персона verbose_name = "Передвижение сотрудника" verbose_name_plural = "Передвижения сотрудников" indexes = [ - models.Index(fields=["worker", "-time"]), - models.Index(fields=["-time",]), - models.Index(fields=["worker", "time"], name="worker_time_idx"), + models.Index(fields=["worker"]), + models.Index(fields=["time",]), + models.Index(fields=["time","worker"]), ]