Skip to content

Commit

Permalink
Consolidate migrations files into one single file #138
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <tdruez@nexb.com>
  • Loading branch information
tdruez committed Aug 6, 2024
1 parent 5712a50 commit ebeedad
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def add_arguments(self, parser):
parser.add_argument(
"--batch-size",
type=int,
default=10,
default=50,
help="Specifies the number of objects per requests to the VulnerableCode service",
)
parser.add_argument(
Expand Down
140 changes: 18 additions & 122 deletions component_catalog/migrations/0006_vulnerability.py
Original file line number Diff line number Diff line change
@@ -1,142 +1,38 @@
# Generated by Django 5.0.6 on 2024-07-15 10:33
# Generated by Django 5.0.6 on 2024-08-06 12:14

import django.db.models.deletion
import dje.fields
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("component_catalog", "0005_remove_component_concluded_license_and_more"),
("dje", "0003_alter_dejacodeuser_homepage_layout"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('component_catalog', '0005_remove_component_concluded_license_and_more'),
('dje', '0003_alter_dejacodeuser_homepage_layout'),
]

operations = [
migrations.CreateModel(
name="Vulnerability",
name='Vulnerability',
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"uuid",
models.UUIDField(
default=uuid.uuid4, editable=False, verbose_name="UUID"
),
),
(
"created_date",
models.DateTimeField(
auto_now_add=True,
db_index=True,
help_text="The date and time the object was created.",
),
),
(
"last_modified_date",
models.DateTimeField(
auto_now=True,
db_index=True,
help_text="The date and time the object was last modified.",
),
),
(
"vulnerability_id",
models.CharField(
help_text="A unique identifier for the vulnerability, prefixed with 'VCID-'. For example, 'VCID-2024-0001'.",
max_length=20,
unique=True,
),
),
(
"summary",
models.TextField(
blank=True,
help_text="A brief summary of the vulnerability, outlining its nature and impact.",
),
),
(
"aliases",
dje.fields.JSONListField(
blank=True,
default=list,
help_text="A list of aliases for this vulnerability, such as CVE identifiers (e.g., 'CVE-2017-1000136').",
),
),
(
"references",
dje.fields.JSONListField(
blank=True,
default=list,
help_text="A list of references for this vulnerability. Each reference includes a URL, an optional reference ID, scores, and the URL for further details. ",
),
),
(
"fixed_packages",
dje.fields.JSONListField(
blank=True,
default=list,
help_text="A list of packages that are not affected by this vulnerability.",
),
),
(
"affected_packages",
models.ManyToManyField(
help_text="Packages that are affected by this vulnerability.",
related_name="affected_by_vulnerabilities",
to="component_catalog.package",
),
),
(
"created_by",
models.ForeignKey(
editable=False,
help_text="The application user who created the object.",
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="created_%(class)ss",
serialize=False,
to=settings.AUTH_USER_MODEL,
),
),
(
"dataspace",
models.ForeignKey(
editable=False,
help_text="A Dataspace is an independent, exclusive set of DejaCode data, which can be either nexB master reference data or installation-specific data.",
on_delete=django.db.models.deletion.PROTECT,
to="dje.dataspace",
),
),
(
"last_modified_by",
dje.fields.LastModifiedByField(
editable=False,
help_text="The application user who last modified the object.",
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="modified_%(class)ss",
serialize=False,
to=settings.AUTH_USER_MODEL,
),
),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, verbose_name='UUID')),
('created_date', models.DateTimeField(auto_now_add=True, db_index=True, help_text='The date and time the object was created.')),
('last_modified_date', models.DateTimeField(auto_now=True, db_index=True, help_text='The date and time the object was last modified.')),
('vulnerability_id', models.CharField(help_text="A unique identifier for the vulnerability, prefixed with 'VCID-'. For example, 'VCID-2024-0001'.", max_length=20, unique=True)),
('summary', models.TextField(blank=True, help_text='A brief summary of the vulnerability, outlining its nature and impact.')),
('aliases', dje.fields.JSONListField(blank=True, default=list, help_text="A list of aliases for this vulnerability, such as CVE identifiers (e.g., 'CVE-2017-1000136').")),
('references', dje.fields.JSONListField(blank=True, default=list, help_text='A list of references for this vulnerability. Each reference includes a URL, an optional reference ID, scores, and the URL for further details. ')),
('fixed_packages', dje.fields.JSONListField(blank=True, default=list, help_text='A list of packages that are not affected by this vulnerability.')),
('affected_components', models.ManyToManyField(help_text='Components affected by this vulnerability.', related_name='affected_by_vulnerabilities', to='component_catalog.component')),
('affected_packages', models.ManyToManyField(help_text='Packages affected by this vulnerability.', related_name='affected_by_vulnerabilities', to='component_catalog.package')),
('dataspace', models.ForeignKey(editable=False, help_text='A Dataspace is an independent, exclusive set of DejaCode data, which can be either nexB master reference data or installation-specific data.', on_delete=django.db.models.deletion.PROTECT, to='dje.dataspace')),
],
options={
"verbose_name_plural": "Vulnerabilities",
"unique_together": {
("dataspace", "uuid"),
("dataspace", "vulnerability_id"),
},
'verbose_name_plural': 'Vulnerabilities',
'unique_together': {('dataspace', 'uuid'), ('dataspace', 'vulnerability_id')},
},
),
]

This file was deleted.

This file was deleted.

0 comments on commit ebeedad

Please sign in to comment.