Skip to content

Commit

Permalink
Migrate qualifiers to plain charfield step 1
Browse files Browse the repository at this point in the history
Create qualifiers_temp temp field

Reference: #1327
Signed-off-by: Philippe Ombredanne <[email protected]>
  • Loading branch information
pombredanne authored and TG1999 committed Dec 20, 2023
1 parent e64362b commit 69f06d4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions vulnerabilities/migrations/0046_package_qualifiers_temp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.13 on 2023-12-05 11:40

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("vulnerabilities", "0045_remove_duplicated_purls_with_name_namespace_mixed"),
]

operations = [
migrations.AddField(
model_name="package",
name="qualifiers_temp",
field=models.CharField(blank=True, max_length=1024),
),
]
11 changes: 11 additions & 0 deletions vulnerabilities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,15 @@ class Package(PackageURLMixin):
"""
A software package with related vulnerabilities.
"""
"""
- X schema migration: create qualifiers_temp
- data migration copy as string the normalized qualifiers to qualifiers_temp
- schema migration: add qualifiers_temp to unique together
- schema migration: remove qualifiers override and from unique together
- data migration copy as string the normalized qualifiers_temp to qualifiers
- schema migration: add qualifiers to unique together
- schema migration: delete qualifiers_temp
"""

"""
- X schema migration: create qualifiers_temp
Expand All @@ -583,6 +592,8 @@ class Package(PackageURLMixin):
# https://github.com/package-url/packageurl-python/pull/67
# gets merged

qualifiers_temp = models.CharField(max_length=1024, blank=True)

vulnerabilities = models.ManyToManyField(
to="Vulnerability", through="PackageRelatedVulnerability"
)
Expand Down

0 comments on commit 69f06d4

Please sign in to comment.