perf: add index to tweak our default search query

Adds an index on PackageBases.Popularity and PackageBases.Name to
improve performance of our default search query sorted by "Popularity"

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-07-02 13:55:21 +02:00
parent c41f2e854a
commit 7c8b9ba6bc
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296

View file

@ -0,0 +1,24 @@
"""Add index on PackageBases.Popularity and .Name
Revision ID: c5a6a9b661a0
Revises: e4e49ffce091
Create Date: 2023-07-02 13:46:52.522146
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "c5a6a9b661a0"
down_revision = "e4e49ffce091"
branch_labels = None
depends_on = None
def upgrade():
op.create_index(
"BasesPopularityName", "PackageBases", ["Popularity", "Name"], unique=False
)
def downgrade():
op.drop_index("BasesPopularityName", table_name="PackageBases")