Skip to content

Commit

Permalink
Delete qualifiers_temp field and unique_togther step 7
Browse files Browse the repository at this point in the history
Reference: #1327
Signed-off-by: Tushar Goel <[email protected]>
Signed-off-by: Philippe Ombredanne <[email protected]>
  • Loading branch information
TG1999 authored and pombredanne committed Dec 5, 2023
1 parent 54731c1 commit ea81926
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.1.7 on 2023-12-05 13:52

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("vulnerabilities", "0051_alter_package_unique_together"),
]

operations = [
migrations.AlterUniqueTogether(
name="package",
unique_together={("type", "namespace", "name", "version", "qualifiers", "subpath")},
),
migrations.RemoveField(
model_name="package",
name="qualifiers_temp",
),
]
19 changes: 5 additions & 14 deletions vulnerabilities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,26 +567,17 @@ class Package(PackageURLMixin):
"""
- X schema migration: create qualifiers_temp
- X 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: add qualifiers_temp to unique together
- X schema migration: remove qualifiers override and from unique together
- X data migration copy as string the normalized qualifiers_temp to qualifiers
- X schema migration: add qualifiers to unique together
- X schema migration: delete qualifiers_temp
"""

# Remove the `qualifers` and `set_package_url` overrides after
# https://github.com/package-url/packageurl-python/pull/35
# https://github.com/package-url/packageurl-python/pull/67
# gets merged
qualifiers = models.JSONField(
default=dict,
help_text="Extra qualifying data for a package such as the name of an OS, "
"architecture, distro, etc.",
blank=True,
null=False,
)

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

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

0 comments on commit ea81926

Please sign in to comment.