From eaececfb927705d21d1be2d3cdf087c3b2e32565 Mon Sep 17 00:00:00 2001 From: Dev Aggarwal Date: Sun, 12 Nov 2023 21:09:50 +0530 Subject: [PATCH] add index for savedrun --- ...lance_alter_appuser_created_at_and_more.py | 38 +++++++++++++++++++ ...bots_savedr_created_cb8e09_idx_and_more.py | 24 ++++++++++++ bots/models.py | 2 + 3 files changed, 64 insertions(+) create mode 100644 app_users/migrations/0010_alter_appuser_balance_alter_appuser_created_at_and_more.py create mode 100644 bots/migrations/0046_savedrun_bots_savedr_created_cb8e09_idx_and_more.py diff --git a/app_users/migrations/0010_alter_appuser_balance_alter_appuser_created_at_and_more.py b/app_users/migrations/0010_alter_appuser_balance_alter_appuser_created_at_and_more.py new file mode 100644 index 000000000..fc8b7f401 --- /dev/null +++ b/app_users/migrations/0010_alter_appuser_balance_alter_appuser_created_at_and_more.py @@ -0,0 +1,38 @@ +# Generated by Django 4.2.5 on 2023-11-12 15:40 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + dependencies = [ + ("app_users", "0009_alter_appusertransaction_options_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="appuser", + name="balance", + field=models.IntegerField(verbose_name="bal"), + ), + migrations.AlterField( + model_name="appuser", + name="created_at", + field=models.DateTimeField( + blank=True, + default=django.utils.timezone.now, + editable=False, + verbose_name="created", + ), + ), + migrations.AlterField( + model_name="appuser", + name="display_name", + field=models.TextField(blank=True, verbose_name="name"), + ), + migrations.AlterField( + model_name="appuser", + name="is_paying", + field=models.BooleanField(default=False, verbose_name="paid"), + ), + ] diff --git a/bots/migrations/0046_savedrun_bots_savedr_created_cb8e09_idx_and_more.py b/bots/migrations/0046_savedrun_bots_savedr_created_cb8e09_idx_and_more.py new file mode 100644 index 000000000..ff6fb4d97 --- /dev/null +++ b/bots/migrations/0046_savedrun_bots_savedr_created_cb8e09_idx_and_more.py @@ -0,0 +1,24 @@ +# Generated by Django 4.2.5 on 2023-11-12 15:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("bots", "0045_savedrun_transaction"), + ] + + operations = [ + migrations.AddIndex( + model_name="savedrun", + index=models.Index( + fields=["-created_at"], name="bots_savedr_created_cb8e09_idx" + ), + ), + migrations.AddIndex( + model_name="savedrun", + index=models.Index( + fields=["-updated_at"], name="bots_savedr_updated_a6c854_idx" + ), + ), + ] diff --git a/bots/models.py b/bots/models.py index b527cd998..937f26e70 100644 --- a/bots/models.py +++ b/bots/models.py @@ -170,6 +170,8 @@ class Meta: ), ] indexes = [ + models.Index(fields=["-created_at"]), + models.Index(fields=["-updated_at"]), models.Index(fields=["workflow"]), models.Index(fields=["workflow", "run_id", "uid"]), models.Index(fields=["workflow", "example_id", "run_id", "uid"]),