Skip to content

Commit

Permalink
feat: Add db index to License.status field
Browse files Browse the repository at this point in the history
This field is used by the license REST APIs for sorting and filtering,
as well as all endpoints which contain license counts by status, which
makes it a good candidate for being indexed.

ENT-8271
  • Loading branch information
pwnage101 committed Jan 29, 2024
1 parent b5baf9e commit 1b86cee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.9 on 2024-01-29 20:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('subscriptions', '0065_subscriptionplan_desired_num_licenses_not_editable'),
]

operations = [
migrations.AddIndex(
model_name='license',
index=models.Index(fields=['subscription_plan', 'status'], name='subscription_plan_status_idx'),
),
]
5 changes: 5 additions & 0 deletions license_manager/apps/subscriptions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,11 @@ class License(TimeStampedModel):
.. pii_types: id,email_address
.. pii_retirement: local_api
"""
class Meta:
indexes = [
models.Index(fields=["subscription_plan", "status"], name="subscription_plan_status_idx"),
]

uuid = models.UUIDField(
primary_key=True,
default=uuid4,
Expand Down

0 comments on commit 1b86cee

Please sign in to comment.