diff --git a/swh/web/common/migrations/0008_save-code-now_indexes_20210106_1327.py b/swh/web/common/migrations/0008_save-code-now_indexes_20210106_1327.py new file mode 100644 --- /dev/null +++ b/swh/web/common/migrations/0008_save-code-now_indexes_20210106_1327.py @@ -0,0 +1,29 @@ +# Generated by Django 2.2.15 on 2021-01-06 13:27 + +# Adds indexes to the Save Code Now tables. + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("swh.web.common", "0007_save_request_task_status_fix_typo"), + ] + + operations = [ + migrations.AddIndex( + model_name="saveauthorizedorigin", + index=models.Index(fields=["url"], name="save_author_url_3e4e9d_idx"), + ), + migrations.AddIndex( + model_name="saveoriginrequest", + index=models.Index( + fields=["origin_url", "status"], name="save_origin_origin__b46350_idx" + ), + ), + migrations.AddIndex( + model_name="saveunauthorizedorigin", + index=models.Index(fields=["url"], name="save_unauth_url_c008fc_idx"), + ), + ] diff --git a/swh/web/common/models.py b/swh/web/common/models.py --- a/swh/web/common/models.py +++ b/swh/web/common/models.py @@ -16,6 +16,7 @@ class Meta: app_label = "swh.web.common" db_table = "save_authorized_origin" + indexes = [models.Index(fields=["url"])] def __str__(self): return self.url @@ -32,6 +33,7 @@ class Meta: app_label = "swh.web.common" db_table = "save_unauthorized_origin" + indexes = [models.Index(fields=["url"])] def __str__(self): return self.url @@ -84,6 +86,7 @@ app_label = "swh.web.common" db_table = "save_origin_request" ordering = ["-id"] + indexes = [models.Index(fields=["origin_url", "status"])] def __str__(self): return str(