BI-2163 - Add multiple species to the species list when creating a program#373
BI-2163 - Add multiple species to the species list when creating a program#373nickpalladino merged 5 commits intodevelopfrom
Conversation
| INSERT INTO species (common_name, description, created_by, updated_by) | ||
| VALUES | ||
| ('Hydrangea', '', user_id, user_id), | ||
| ('Red Clover', '', user_id, user_id), | ||
| ('Potato', '', user_id, user_id), | ||
| ('Blackberry', '', user_id, user_id), | ||
| ('Raspberry', '', user_id, user_id), | ||
| ('Sugar Beet', '', user_id, user_id), | ||
| ('Strawberry', '', user_id, user_id), | ||
| ('Coffee', '', user_id, user_id), | ||
| ('Hop', '', user_id, user_id) ON CONFLICT DO NOTHING; |
There was a problem hiding this comment.
What will this do if, for example, Hydrangea exists in the database but the others do not? Will it do a partial insert or just abort the whole statement? Might be better to do one insert per species.
There's a chance one or more of these species will be manually added to production before the next major release if there is an urgent need for it, so it would be best to account for that and assume that at least one of these species will already exist in the database.
There was a problem hiding this comment.
From what I saw it's supposed to continue on if one fails and do the rest, I can test and make sure that's the case and change it if not.
There was a problem hiding this comment.
Working as expected when Hydrangea exists in the database prior to the migration, all the rest are added.
| ALTER TABLE species | ||
| ADD CONSTRAINT unique_common_name UNIQUE (common_name); |
There was a problem hiding this comment.
Did you check qa-test and rel-test for duplicates as well as production?
There was a problem hiding this comment.
Just did, they don't have duplicates
Description
Story: BI-2163
Dependencies
Testing
Checklist: