/**
   * Executes MOLGENIS MetaData version upgrades.
   *
   * @return true if an upgrade was necessary, false if not
   */
  @Override
  public boolean upgrade() {
    if (versionService.getMolgenisVersionFromServerProperties() < 19) {
      throw new UnsupportedOperationException(
          "Upgrading from versions below 1.10 (metadataversion 19) is not supported, please update to 1.10 first.");
    }
    if (versionService.getMolgenisVersionFromServerProperties()
        < MolgenisVersionService.CURRENT_VERSION) {
      LOG.info(
          "MetaData version:{}, current version:{} upgrade needed",
          versionService.getMolgenisVersionFromServerProperties(),
          MolgenisVersionService.CURRENT_VERSION);

      upgrades
          .stream()
          .filter(
              upgrade ->
                  upgrade.getFromVersion()
                      >= versionService.getMolgenisVersionFromServerProperties())
          .forEach(this::runUpgrade);

      versionService.updateToCurrentVersion();

      LOG.info("MetaData upgrade done.");
      return true;
    } else {
      LOG.debug(
          "MetaData version:{}, current version:{} upgrade not needed",
          versionService.getMolgenisVersionFromServerProperties(),
          MolgenisVersionService.CURRENT_VERSION);
      return false;
    }
  }
 private void runUpgrade(MolgenisUpgrade upgrade) {
   LOG.info("Upgrading from {} to {}...", upgrade.getFromVersion(), upgrade.getToVersion());
   upgrade.upgrade();
   LOG.debug("Upgraded from {} to {}.", upgrade.getFromVersion(), upgrade.getToVersion());
   versionService.updateToVersion(upgrade.getToVersion());
 }