Skip to content

Commit

Permalink
update(web_api): index more created_at based queries (#794)
Browse files Browse the repository at this point in the history
technically we only need to index:
  - github_event.created_at
  - user_pull_request_activity_progress.created_at
  - pul_request_activity_progress.created_at

but it was easier to update the parent class instead of
the specific ones.
  • Loading branch information
sbdchd authored Mar 25, 2022
1 parent 533e5fa commit ea26b8c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions web_api/web_api/migrations/0026_auto_20220322_0036.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated by Django 3.0.3 on 2022-03-22 00:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("web_api", "0025_auto_20200902_0052"),
]

operations = [
migrations.AlterField(
model_name="account",
name="created_at",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name="accountmembership",
name="created_at",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name="githubevent",
name="created_at",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name="pullrequestactivity",
name="created_at",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name="pullrequestactivityprogress",
name="created_at",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name="user",
name="created_at",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name="userpullrequestactivity",
name="created_at",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name="userpullrequestactivityprogress",
name="created_at",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
]
2 changes: 1 addition & 1 deletion web_api/web_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _repr(self: object) -> str:

class BaseModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4)
created_at = models.DateTimeField(auto_now_add=True)
created_at = models.DateTimeField(auto_now_add=True, db_index=True)
modified_at = models.DateTimeField(auto_now=True)

class Meta:
Expand Down

0 comments on commit ea26b8c

Please sign in to comment.