Skip to content

Commit

Permalink
Merge pull request #3346 from Minnozz/status-remote-id-index
Browse files Browse the repository at this point in the history
Add index on Status.remote_id
  • Loading branch information
mouse-reeve committed Apr 2, 2024
2 parents f28800a + 4bbdd0b commit f085d3d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bookwyrm/migrations/0199_status_bookwyrm_st_remote__06aeba_idx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.25 on 2024-04-02 19:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0198_book_search_vector_author_aliases"),
]

operations = [
migrations.AddIndex(
model_name="status",
index=models.Index(
fields=["remote_id"], name="bookwyrm_st_remote__06aeba_idx"
),
),
]
3 changes: 3 additions & 0 deletions bookwyrm/models/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class Meta:
"""default sorting"""

ordering = ("-published_date",)
indexes = [
models.Index(fields=["remote_id"]),
]

def save(self, *args, **kwargs):
"""save and notify"""
Expand Down

0 comments on commit f085d3d

Please sign in to comment.