Skip to content

BI-2163 - Add multiple species to the species list when creating a program#373

Merged
nickpalladino merged 5 commits intodevelopfrom
feature/BI-2163
Jul 23, 2024
Merged

BI-2163 - Add multiple species to the species list when creating a program#373
nickpalladino merged 5 commits intodevelopfrom
feature/BI-2163

Conversation

@nickpalladino
Copy link
Member

@nickpalladino nickpalladino commented Jul 10, 2024

Description

Story: BI-2163

  • Added db migration to update species list

Dependencies

  • None

Testing

  • Verify that the new species are listed in the program creation select box
  • Verify that if a species is already in the database the migration does not create a duplicate

Checklist:

  • I have performed a self-review of my own code
  • I have tested my code and ensured it meets the acceptance criteria of the story
  • I have tested that my code works with both the brapi-java-server and BreedBase
  • I have create/modified unit tests to cover this change
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to documentation
  • I have run TAF: <please include a link to TAF run>

@nickpalladino nickpalladino marked this pull request as ready for review July 22, 2024 14:41
@nickpalladino nickpalladino requested review from a team, HMS17 and mlm483 and removed request for a team July 22, 2024 14:41
Comment on lines +29 to +39
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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Working as expected when Hydrangea exists in the database prior to the migration, all the rest are added.

Comment on lines +18 to +19
ALTER TABLE species
ADD CONSTRAINT unique_common_name UNIQUE (common_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you check qa-test and rel-test for duplicates as well as production?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just did, they don't have duplicates

@nickpalladino nickpalladino requested a review from mlm483 July 22, 2024 18:07
@nickpalladino nickpalladino merged commit 309cf85 into develop Jul 23, 2024
@nickpalladino nickpalladino deleted the feature/BI-2163 branch July 23, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants