DO $$
BEGIN
    IF EXISTS (
        SELECT 1
        FROM information_schema.columns
        WHERE table_schema = 'akuz'
          AND table_name = 't_route_record'
          AND column_name = 'outcomerecord'
    ) THEN
        ALTER TABLE akuz.t_route_record
        DROP CONSTRAINT IF EXISTS fk_t_medical_record_t_route_record_outcomerecord;
        
	    call public.sp_alterdropcolumn('akuz.t_route_record' , 'outcomerecord');
    END IF;
END $$;