Skip to content

Commit c7ecab9

Browse files
committed
add detected_date on AffectedByVulnerabilityRelationship
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent fb41ff4 commit c7ecab9

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Generated by Django 6.0 on 2026-07-20
2+
3+
import django.utils.timezone
4+
from django.db import migrations
5+
from django.db import models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
("component_catalog", "0013_package_package_content"),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name="componentaffectedbyvulnerability",
17+
name="detected_date",
18+
field=models.DateTimeField(
19+
auto_now_add=True,
20+
default=django.utils.timezone.now,
21+
help_text=(
22+
"Date and time when this vulnerability was first detected on this object. "
23+
"Used to measure how long a vulnerability has remained unaddressed. "
24+
"Defaults to the time the record was created."
25+
),
26+
),
27+
preserve_default=False,
28+
),
29+
migrations.AddField(
30+
model_name="packageaffectedbyvulnerability",
31+
name="detected_date",
32+
field=models.DateTimeField(
33+
auto_now_add=True,
34+
default=django.utils.timezone.now,
35+
help_text=(
36+
"Date and time when this vulnerability was first detected on this object. "
37+
"Used to measure how long a vulnerability has remained unaddressed. "
38+
"Defaults to the time the record was created."
39+
),
40+
),
41+
preserve_default=False,
42+
),
43+
]

vulnerabilities/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,14 @@ class AffectedByVulnerabilityRelationship(DataspacedModel):
393393
to="vulnerabilities.Vulnerability",
394394
on_delete=models.CASCADE,
395395
)
396+
detected_date = models.DateTimeField(
397+
auto_now_add=True,
398+
help_text=_(
399+
"Date and time when this vulnerability was first detected on this object. "
400+
"Used to measure how long a vulnerability has remained unaddressed. "
401+
"Defaults to the time the record was created."
402+
),
403+
)
396404

397405
class Meta:
398406
abstract = True

0 commit comments

Comments
 (0)