-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #827 from TG1999/clean_migration
Delete references to CPEs with empty URLs #818
- Loading branch information
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
vulnerabilities/migrations/0017_delete_reference_to_cpes_with_empty_urls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.0.4 on 2022-08-05 12:55 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('vulnerabilities', '0016_update_cpe_url'), | ||
] | ||
|
||
def delete_reference_to_cpes_with_empty_urls(apps, _): | ||
""" | ||
Delete references to CPEs with empty URLs. | ||
https://github.com/nexB/vulnerablecode/issues/818#issuecomment-1206437637 | ||
""" | ||
Reference = apps.get_model("vulnerabilities", "VulnerabilityReference") | ||
Reference.objects.filter(reference_id__startswith="cpe", url="").delete() | ||
|
||
operations = [ | ||
migrations.RunPython(delete_reference_to_cpes_with_empty_urls, migrations.RunPython.noop), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters