Skip to content

Commit

Permalink
SearchQuery: use BigAutoField for primary key (#9671)
Browse files Browse the repository at this point in the history
* 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 #9492

* Linter
  • Loading branch information
stsewd authored Sep 26, 2023
1 parent 7bc5c76 commit 27d956a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions readthedocs/search/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class SearchConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = 'readthedocs.search'

def ready(self):
Expand Down
19 changes: 19 additions & 0 deletions readthedocs/search/migrations/0005_alter_searchquery_id.py
Original file line number Diff line number Diff line change
@@ -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"
),
),
]

0 comments on commit 27d956a

Please sign in to comment.