How to fix "Add not null constraint on collection protocol id of specimen table" error?
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

How to fix "Add not null constraint on collection protocol id of specimen table" error?

This problem occurs when one or more specimens exist into the database, which are not associated with any collection protocol. In CaTissue there was no check or constraint on specimen that should be associated with a CP. As a result, when upgrading to more stricter OpenSpecimen, migration of such inconsistent data fails.

To solve the problem, create a new collection protocol and associate the all dangling specimens to it.

Step 1: Create a new collection protocol.

insert into catissue_collection_protocol(identifier, title, short_title, activity_status) values (catissue_specimen_protocol_seq.nextVal, 'Dangling Records CP', 'Dangling Records CP', 'Disabled');

 

Step 2: Take the identifier of the created collection protocol.

select identifier from catissue_collection_protocol where title = 'Dangling Records CP';

 

Step 3: Set the collection protocol to dangling specimens.

update catissue_specimen set collection_protocol_id = <identifier_received_in step_2> where collection_protocol_id is null;

 

Step 4: Restart the Tomcat server.

 

 

 

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com