Skip to content

Commit

Permalink
Reset migrations
Browse files Browse the repository at this point in the history
Signed-off-by: Hritik Vijay <hritikxx8@gmail.com>
  • Loading branch information
Hritik14 committed Jan 23, 2022
1 parent 7d84c41 commit e25b437
Showing 1 changed file with 113 additions and 60 deletions.
173 changes: 113 additions & 60 deletions vulnerabilities/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Generated by Django 3.2.9 on 2021-12-08 09:02
# Generated by Django 3.2.9 on 2022-01-23 14:44

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):
Expand All @@ -12,46 +13,6 @@ class Migration(migrations.Migration):
dependencies = []

operations = [
migrations.CreateModel(
name="Advisory",
fields=[
(
"id",
models.AutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
("vulnerability_id", models.CharField(blank=True, max_length=50, null=True)),
("summary", models.TextField(blank=True, null=True)),
("affected_packages", models.TextField()),
("references", models.TextField()),
(
"date_published",
models.DateField(
blank=True, help_text="UTC Date of publication of the advisory", null=True
),
),
(
"date_collected",
models.DateField(help_text="UTC Date on which the advisory was collected"),
),
(
"date_improved",
models.DateTimeField(
blank=True,
help_text="Latest date on which the advisory was improved by an improver",
null=True,
),
),
(
"created_by",
models.CharField(
help_text="Fully qualified name of the importer prefixed with the module name importing the advisory. Eg: vulnerabilities.importers.nginx.NginxDataSource",
max_length=100,
),
),
],
),
migrations.CreateModel(
name="Importer",
fields=[
Expand Down Expand Up @@ -155,23 +116,19 @@ class Migration(migrations.Migration):
),
(
"vulnerability_id",
models.CharField(
help_text="Unique identifier for a vulnerability: this is either a published CVE id (as in CVE-2020-7965) if it exists. Otherwise this is a VulnerableCode-assigned VULCOID (as in VULCOID-20210222-1315-16461541). When a vulnerability CVE is assigned later we replace this with the CVE and keep the 'old' VULCOID in the 'old_vulnerability_id' field to support redirection to the CVE id.",
max_length=50,
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text="Unique identifier for a vulnerability in this database, assigned automatically. In the external representation it is prefixed with VULCOID-",
unique=True,
),
),
(
"old_vulnerability_id",
models.CharField(
blank=True,
help_text="empty if no CVE else VC id",
max_length=50,
null=True,
unique=True,
"summary",
models.TextField(
blank=True, help_text="Summary of the vulnerability", null=True
),
),
("summary", models.TextField(blank=True, help_text="Summary of the vulnerability")),
],
options={
"verbose_name_plural": "Vulnerabilities",
Expand Down Expand Up @@ -226,7 +183,7 @@ class Migration(migrations.Migration):
"created_by",
models.CharField(
blank=True,
help_text="Fully qualified name of the improver prefixed with the module name responsible for creating this relation. Eg: vulnerabilities.importers.nginx.NginxTimeTravel",
help_text="Fully qualified name of the improver prefixed with themodule name responsible for creating this relation. Eg:vulnerabilities.importers.nginx.NginxBasicImprover",
max_length=100,
),
),
Expand Down Expand Up @@ -266,7 +223,6 @@ class Migration(migrations.Migration):
],
options={
"verbose_name_plural": "PackageRelatedVulnerabilities",
"unique_together": {("package", "vulnerability")},
},
),
migrations.AddField(
Expand All @@ -279,7 +235,7 @@ class Migration(migrations.Migration):
),
),
migrations.CreateModel(
name="VulnerabilitySeverity",
name="Alias",
fields=[
(
"id",
Expand All @@ -288,8 +244,93 @@ class Migration(migrations.Migration):
),
),
(
"value",
models.CharField(help_text="Example: 9.0, Important, High", max_length=50),
"alias",
models.CharField(
help_text="An alias is a unique vulnerability identifier in some database, such as CVE-2020-2233",
max_length=50,
unique=True,
),
),
(
"vulnerability",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="aliases",
to="vulnerabilities.vulnerability",
),
),
],
),
migrations.CreateModel(
name="Advisory",
fields=[
(
"id",
models.AutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
(
"aliases",
models.JSONField(blank=True, default=list, help_text="A list of alias strings"),
),
("summary", models.TextField(blank=True, null=True)),
(
"affected_packages",
models.JSONField(
blank=True,
default=list,
help_text="A list of serializable AffectedPackage objects",
),
),
(
"references",
models.JSONField(
blank=True,
default=list,
help_text="A list of serializable Reference objects",
),
),
(
"date_published",
models.DateTimeField(
blank=True, help_text="UTC Date of publication of the advisory", null=True
),
),
(
"date_collected",
models.DateTimeField(help_text="UTC Date on which the advisory was collected"),
),
(
"date_improved",
models.DateTimeField(
blank=True,
help_text="Latest date on which the advisory was improved by an improver",
null=True,
),
),
(
"created_by",
models.CharField(
help_text="Fully qualified name of the importer prefixed with themodule name importing the advisory. Eg:vulnerabilities.importers.nginx.NginxDataSource",
max_length=100,
),
),
],
options={
"unique_together": {
("aliases", "summary", "affected_packages", "references", "date_published")
},
},
),
migrations.CreateModel(
name="VulnerabilitySeverity",
fields=[
(
"id",
models.AutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
(
"scoring_system",
Expand All @@ -308,10 +349,14 @@ class Migration(migrations.Migration):
("generic_textual", "Generic textual severity rating"),
("apache_httpd", "Apache Httpd Severity"),
],
help_text="identifier for the scoring system used. Available choices are: cvssv2 is vulnerability_id for CVSSv2 Base Score system, cvssv2_vector is vulnerability_id for CVSSv2 Vector system, cvssv3 is vulnerability_id for CVSSv3 Base Score system, cvssv3_vector is vulnerability_id for CVSSv3 Vector system, cvssv3.1 is vulnerability_id for CVSSv3.1 Base Score system, cvssv3.1_vector is vulnerability_id for CVSSv3.1 Vector system, rhbs is vulnerability_id for RedHat Bugzilla severity system, rhas is vulnerability_id for RedHat Aggregate severity system, avgs is vulnerability_id for Archlinux Vulnerability Group Severity system, cvssv3.1_qr is vulnerability_id for CVSSv3.1 Qualitative Severity Rating system, generic_textual is vulnerability_id for Generic textual severity rating system, apache_httpd is vulnerability_id for Apache Httpd Severity system ",
help_text="Identifier for the scoring system used. Available choices are: cvssv2 is vulnerability_id for CVSSv2 Base Score system, cvssv2_vector is vulnerability_id for CVSSv2 Vector system, cvssv3 is vulnerability_id for CVSSv3 Base Score system, cvssv3_vector is vulnerability_id for CVSSv3 Vector system, cvssv3.1 is vulnerability_id for CVSSv3.1 Base Score system, cvssv3.1_vector is vulnerability_id for CVSSv3.1 Vector system, rhbs is vulnerability_id for RedHat Bugzilla severity system, rhas is vulnerability_id for RedHat Aggregate severity system, avgs is vulnerability_id for Archlinux Vulnerability Group Severity system, cvssv3.1_qr is vulnerability_id for CVSSv3.1 Qualitative Severity Rating system, generic_textual is vulnerability_id for Generic textual severity rating system, apache_httpd is vulnerability_id for Apache Httpd Severity system ",
max_length=50,
),
),
(
"value",
models.CharField(help_text="Example: 9.0, Important, High", max_length=50),
),
(
"reference",
models.ForeignKey(
Expand All @@ -328,11 +373,19 @@ class Migration(migrations.Migration):
),
],
options={
"unique_together": {("vulnerability", "reference", "scoring_system")},
"unique_together": {("vulnerability", "reference", "scoring_system", "value")},
},
),
migrations.AddIndex(
model_name="packagerelatedvulnerability",
index=models.Index(fields=["fix"], name="vulnerabili_fix_100a33_idx"),
),
migrations.AlterUniqueTogether(
name="packagerelatedvulnerability",
unique_together={("package", "vulnerability")},
),
migrations.AlterUniqueTogether(
name="package",
unique_together={("name", "namespace", "type", "version", "qualifiers", "subpath")},
unique_together={("type", "namespace", "name", "version", "qualifiers", "subpath")},
),
]

0 comments on commit e25b437

Please sign in to comment.