How to fix the failing "Remove unique constraint to allow duplicate specimen label" change set?
Got feedback or spotted a mistake?

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

How to fix the failing "Remove unique constraint to allow duplicate specimen label" change set?

The error "Cannot drop constraint - nonexistent constraint" occurs when either of the following condition is true:

  1. The required unique constraint on catissue_specimen (label) is not present

  2. The constraint is present but the auto-generated name is different from the one expected by the change script

To determine which of the above condition is true, execute below SQL

SQL 1
select constraint_name from user_cons_columns where table_name = 'CATISSUE_SPECIMEN' and column_name = 'LABEL'

If the above SQL returns no rows then condition 1 is true. Otherwise its condition 2.

Solutions

Condition 1: Unique constraint not present

The idea is to add an unique constraint that the change script is anticipating

  1. Add a unique constraint on catissue_specimen (label) using below SQL

    SQL 2

    alter table catissue_specimen add constraint SYS_C00107672 unique(label);
  2. Restart OpenSpecimen

Condition 2: Unique constraint name differs

The idea is to rename the constraint to match with that anticipated by the change script

  1. Rename unique constraint name as below

    SQL 3

    alter table catissue_specimen rename constraint <output of SQL 1> to SYS_C00107672;
  2. Restart OpenSpecimen

 

 

 

Got feedback or spotted a mistake?

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