Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix severity model #731

Merged
merged 2 commits into from
May 21, 2022
Merged

Fix severity model #731

merged 2 commits into from
May 21, 2022

Conversation

TG1999
Copy link
Contributor

@TG1999 TG1999 commented May 16, 2022

Fix severity model

Signed-off-by: Tushar Goel [email protected]

@TG1999 TG1999 changed the title Reference: https://github.com/nexB/vulnerablecode/issues/729 Fix severity model May 16, 2022
@TG1999
Copy link
Contributor Author

TG1999 commented May 16, 2022

@pombredanne , If I run this migration on existing tables, I end up getting this

django.db.utils.IntegrityError: could not create unique index "vulnerabilities_vulnerab_reference_id_scoring_sys_654bcb0a_uniq"
DETAIL:  Key (reference_id, scoring_system, value)=(1127, rhas, Important) is duplicated.

What will be the best workaround for this to run on existing tables ?

As of now this works on empty tables only.

@pombredanne
Copy link
Member

You would have to make a data migration first to correct the data to ensure that there are no duplicates first and you discard these.
Also removing the vulnerability from the foreign key is not the solution IMHO. Rather just remove vulnerability from the unique together?

@TG1999 TG1999 force-pushed the fix_severity_model branch 4 times, most recently from 77c71ec to b4a4aeb Compare May 17, 2022 19:35
Fix severity model

Signed-off-by: Tushar Goel <[email protected]>
Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

Signed-off-by: Tushar Goel <[email protected]>
@TG1999 TG1999 merged commit 1717f51 into aboutcode-org:main May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants