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

migrations: Add unique db constraint for firmware #131

Merged
merged 2 commits into from
Aug 12, 2022

Conversation

diogomatsubara
Copy link
Contributor

enforce component_firmware_version table to have unique values on columns
vendor, model and version.

Also renamed migration 00010_server_components_idx.sql to use consistent numbering scheme.

enforce component_firmware_version table to have unique values on columns
 vendor, model and version.
@diogomatsubara diogomatsubara requested a review from a team as a code owner August 11, 2022 14:51
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2022

Codecov Report

Merging #131 (8f0b0de) into main (2d845d2) will increase coverage by 0.15%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   74.00%   74.15%   +0.15%     
==========================================
  Files          32       32              
  Lines        2577     2577              
==========================================
+ Hits         1907     1911       +4     
+ Misses        494      491       -3     
+ Partials      176      175       -1     
Flag Coverage Δ
unittests 74.15% <ø> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/api/v1/router_firmware.go 57.40% <0.00%> (+3.70%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@nicolerenee nicolerenee left a comment

Choose a reason for hiding this comment

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

Can we add a test that ensures this is working and to make sure we see a failure if it is removed.

ComponentFirmwareVersion has a db constraint for unique values of
vendor/model/version. Test demonstrates that we raise an error in case
an attempt is made to create a new record with the duplicated values.
@diogomatsubara
Copy link
Contributor Author

Can we add a test that ensures this is working and to make sure we see a failure if it is removed.

Thanks for the review @nicolerenee, I added a test case in 8f0b0de. Let me know what you think.

@nicolerenee nicolerenee merged commit 229659b into metal-toolbox:main Aug 12, 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.

3 participants