From 27d956a3f857b6e113598dc40e122f5d4ab046a1 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Tue, 26 Sep 2023 11:51:18 -0500 Subject: [PATCH] SearchQuery: use BigAutoField for primary key (#9671) * SearchQuery: use BigAutoField for primary key We have 5M records, so migration shouldn't take that long (1-2 min?), and we use a task to create the records, so this shouldn't affect search. ```python In [1]: SearchQuery.objects.count() Out[1]: 5062590 ``` Ref https://github.com/readthedocs/readthedocs.org/issues/9492 * Linter --- readthedocs/search/apps.py | 1 + .../migrations/0005_alter_searchquery_id.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 readthedocs/search/migrations/0005_alter_searchquery_id.py diff --git a/readthedocs/search/apps.py b/readthedocs/search/apps.py index 6159f3ad4d0..fbde660a4d7 100644 --- a/readthedocs/search/apps.py +++ b/readthedocs/search/apps.py @@ -2,6 +2,7 @@ class SearchConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" name = 'readthedocs.search' def ready(self): diff --git a/readthedocs/search/migrations/0005_alter_searchquery_id.py b/readthedocs/search/migrations/0005_alter_searchquery_id.py new file mode 100644 index 00000000000..6cb537a8b16 --- /dev/null +++ b/readthedocs/search/migrations/0005_alter_searchquery_id.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.15 on 2022-10-18 15:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("search", "0004_make_total_results_not_null"), + ] + + operations = [ + migrations.AlterField( + model_name="searchquery", + name="id", + field=models.BigAutoField( + auto_created=True, primary_key=True, serialize=False, verbose_name="ID" + ), + ), + ]