Skip to content

Conversation

@TG1999
Copy link
Contributor

@TG1999 TG1999 commented May 16, 2022

Fix severity model

Signed-off-by: Tushar Goel tushar.goel.dav@gmail.com

@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 <tushar.goel.dav@gmail.com>
@TG1999 TG1999 force-pushed the fix_severity_model branch from b4a4aeb to 24a0e26 Compare May 20, 2022 16:48
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 <tushar.goel.dav@gmail.com>
@TG1999 TG1999 force-pushed the fix_severity_model branch from 24a0e26 to f5222a1 Compare May 21, 2022 09:31
@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