Uh oh!
There was an error while loading. Please reload this page.
[BI-2903] Support for program_id in germplasm table - #23
Conversation
| ADD CONSTRAINT germplasm_program_fk | ||
| FOREIGN KEY (program_id) | ||
| REFERENCES public.program(id) | ||
| ON DELETE CASCADE; |
There was a problem hiding this comment.
Wonder if we should not cascade, seems the convention for other entities related to program like trials and studies, etc. is no action.
| updateSynonymEntities(request.getSynonyms(), entity); | ||
| if (request.getTaxonIds() != null) | ||
| updateTaxonEntities(request.getTaxonIds(), entity); | ||
| if (!foundProgramsByDbId.isEmpty()) { |
There was a problem hiding this comment.
Not applicable for deltabreed use case but may want to fix for general usage. Since foundProgramsByDbId is shared across germplasm in the batch if some germplasm have a program id and some don't then this could result in a NullPointerException on the UUID.fromString call because request.getProgramDbId() could be null.
Something like this should resolve it:
if (request.getProgramDbId() != null) {
ProgramEntity program =
foundProgramsByDbId.get(UUID.fromString(request.getProgramDbId()));
entity.setProgram(program);
}
| SELECT g.id AS germplasm_id, p.id AS program_id | ||
| from germplasm g | ||
| JOIN germplasm_external_references gex ON g.id = gex.germplasm_entity_id | ||
| JOIN external_reference ex ON ex.id = gex.external_references_id |
There was a problem hiding this comment.
Maybe we should also constrain on the germplasm exref source being breedinginsight.org/programs
Description
Story:BI-2903
program_idcolumn to thegermplasmalong with a foreign constraint and index to support BI's need to lookup germplasm by program id directly.Dependencies
brapi
Testing
programDbIdandprogramNameprogramDbIdsandprogramNamesprogramDbIdpresentprogramDbIds present in requested germplasm objects to createChecklist: