From ea81926a58944ce15377ce45a48ad4c77f09902e Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Tue, 5 Dec 2023 19:24:11 +0530 Subject: [PATCH] Delete qualifiers_temp field and unique_togther step 7 Reference: https://github.com/nexB/vulnerablecode/issues/1327 Signed-off-by: Tushar Goel Signed-off-by: Philippe Ombredanne --- ..._alter_package_unique_together_and_more.py | 21 +++++++++++++++++++ vulnerabilities/models.py | 19 +++++------------ 2 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 vulnerabilities/migrations/0052_alter_package_unique_together_and_more.py diff --git a/vulnerabilities/migrations/0052_alter_package_unique_together_and_more.py b/vulnerabilities/migrations/0052_alter_package_unique_together_and_more.py new file mode 100644 index 000000000..93511b14f --- /dev/null +++ b/vulnerabilities/migrations/0052_alter_package_unique_together_and_more.py @@ -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", + ), + ] diff --git a/vulnerabilities/models.py b/vulnerabilities/models.py index 923839a64..497024f94 100644 --- a/vulnerabilities/models.py +++ b/vulnerabilities/models.py @@ -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"