do $$ begin
    IF EXISTS(select * from pg_indexes where schemaname ilike 'AKUZ' and tablename ilike 'T_FPUMP_AMB_VISIT_DIAGNOSIS' and indexname ilike 'UQ_T_FPUMP_AMB_VISIT_DIAGNOSIS_Visit')
    THEN
        drop index AKUZ.UQ_T_FPUMP_AMB_VISIT_DIAGNOSIS_Visit;
    END IF;
end; 
$$;

ALTER TABLE AKUZ.T_FPUMP_AMB_VISIT_DIAGNOSIS DROP CONSTRAINT if exists UQ_T_FPUMP_AMB_VISIT_DIAGNOSIS_Visit;

ALTER TABLE AKUZ.T_FPUMP_AMB_VISIT_DIAGNOSIS DROP COLUMN if exists Visit_UQ;
