do $$
begin
    if exists (select 1 
               from information_schema.table_constraints 
               where constraint_name = 'uq_t_medical_description_medicalrequestitem' 
                 and table_schema = 'ies' 
                 and table_name = 't_medical_description') then
        alter table ies.t_medical_description
        drop constraint uq_t_medical_description_medicalrequestitem;
    end if;
end $$;

do $$
begin
    if exists (select 1 
               from information_schema.columns 
               where table_schema = 'ies' 
                 and table_name = 't_medical_description' 
                 and column_name = 'medicalrequestitem_uq') then
        alter table ies.t_medical_description
        drop column medicalrequestitem_uq;
    end if;
end $$;

