-- RenameIndex (safe guard for environments where the old truncated index never existed) DO $$ BEGIN IF to_regclass('"OfficialNormativeSuggestion_stateCode_municipalityCode_createdA"') IS NOT NULL THEN ALTER INDEX "OfficialNormativeSuggestion_stateCode_municipalityCode_createdA" RENAME TO "OfficialNormativeSuggestion_stateCode_municipalityCode_crea_idx"; END IF; END $$;