@Transactional
  public UpgradeEntity merge(UpgradeEntity upgradeEntity) {
    return entityManagerProvider.get().merge(upgradeEntity);
  }
Gets the only revertable upgrade if one exists. By definition, only the
most recent {@code RepositoryType#PATCH} or {@code RepositoryType#MAINT}
upgrade which doesn't have a downgrade already is revertable.
<p>
This method tries to use some fancy SQL to do the work instead of relying
on columns to be set correctly.

@param clusterId
         the cluster id
@return the upgrade which can be reverted, or {@code null} if not found
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UpgradeDAO.java