Skip to content

Commit 4dcf99c

Browse files
committed
Defer db indexing for content id
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 060af18 commit 4dcf99c

File tree

3 files changed

+2
-20
lines changed

3 files changed

+2
-20
lines changed

vulnerabilities/migrations/0089_alter_advisory_unique_content_id.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 4.2.16 on 2025-02-12 13:41
1+
# Generated by Django 4.2.17 on 2025-02-27 07:47
22

33
from django.db import migrations, models
44

@@ -15,7 +15,6 @@ class Migration(migrations.Migration):
1515
name="unique_content_id",
1616
field=models.CharField(
1717
blank=True,
18-
db_index=True,
1918
help_text="A 64 character unique identifier for the content of the advisory since we use sha256 as hex",
2019
max_length=64,
2120
),

vulnerabilities/migrations/0090_alter_advisory_unique_together.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

vulnerabilities/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,6 @@ class Advisory(models.Model):
13171317

13181318
unique_content_id = models.CharField(
13191319
max_length=64,
1320-
db_index=True,
13211320
blank=True,
13221321
help_text="A 64 character unique identifier for the content of the advisory since we use sha256 as hex",
13231322
)
@@ -1356,6 +1355,7 @@ class Advisory(models.Model):
13561355
objects = AdvisoryQuerySet.as_manager()
13571356

13581357
class Meta:
1358+
unique_together = ["aliases", "unique_content_id", "date_published", "url"]
13591359
ordering = ["aliases", "date_published", "unique_content_id"]
13601360

13611361
def save(self, *args, **kwargs):

0 commit comments

Comments
 (0)