-
Notifications
You must be signed in to change notification settings - Fork 271
allow asset group selectors with the same name to exist under different asset groups #210
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
Conversation
5fac966 to
968ac5b
Compare
zinic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment on the DROP CONSTRAINT SQL statement. Changes otherwise look good.
d95b1b5 to
5f2e7ce
Compare
Changes were made accordingly, unblocking PR
|
Looks good, feel free to pull |
zinic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull!
Description
Currently, the name field of an asset group selector needs to be unique regardless of the asset group. This prevents custom “High Value” nodes from being added to the “Owned” group and vice versa in BHCE, and would cause further problems if we want to add additional groups in the future. Trying to add a duplicate selector causes an error.
This story drops that constraint and creates a new uniqueness constraint on both the name and asset_group_id columns, thereby allowing a selector to exist under both Owned as well as HVT asset groups.
How Has This Been Tested?
I spun up a database on the main branch to simulate an existing DB. The selectors table has a constraint on the name column here:
Then I restarted the environment to have the migration applied:
Verified that the constraint has been updated (the new constraint name contains both column names in it):
Then I created 2 selectors with the same name but belonging to the 2 different asset groups via postman:
And verified through the database that both the selectors were created:
Next, I wiped out my database and re-created it to verify that any fresh installs will have the right constraint set up, and then repeated the selecor creation via postman to verify that multiple selectors can exist with the same name:
Types of changes
Checklist: