Skip to content

Commit 2222287

Browse files
committed
Add timestamp to impacted packages
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 9bcb298 commit 2222287

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

vulnerabilities/migrations/0100_remove_advisoryv2_affecting_packages_and_more.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 4.2.22 on 2025-07-18 16:52
1+
# Generated by Django 4.2.22 on 2025-07-22 09:15
22

33
from django.db import migrations, models
44
import django.db.models.deletion
@@ -52,6 +52,14 @@ class Migration(migrations.Migration):
5252
max_length=500,
5353
),
5454
),
55+
(
56+
"created_at",
57+
models.DateTimeField(
58+
auto_now_add=True,
59+
db_index=True,
60+
help_text="Timestamp indicating when this impact was added.",
61+
),
62+
),
5563
(
5664
"advisory",
5765
models.ForeignKey(
@@ -77,11 +85,5 @@ class Migration(migrations.Migration):
7785
),
7886
),
7987
],
80-
options={
81-
"indexes": [
82-
models.Index(fields=["affecting_vers"], name="vulnerabili_affecti_0092a7_idx"),
83-
models.Index(fields=["fixed_vers"], name="vulnerabili_fixed_v_0fda9f_idx"),
84-
],
85-
},
8688
),
8789
]

vulnerabilities/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2873,11 +2873,11 @@ class ImpactedPackage(models.Model):
28732873
help_text="Packages vulnerable to this impact.",
28742874
)
28752875

2876-
class Meta:
2877-
indexes = [
2878-
models.Index(fields=["affecting_vers"]),
2879-
models.Index(fields=["fixed_vers"]),
2880-
]
2876+
created_at = models.DateTimeField(
2877+
auto_now_add=True,
2878+
db_index=True,
2879+
help_text="Timestamp indicating when this impact was added.",
2880+
)
28812881

28822882
def to_affected_package(self):
28832883
"""Return `AffectedPackageV2` data from the impact."""

0 commit comments

Comments
 (0)