code: @RequirePOST
      public HttpResponse doUpgrade(StaplerRequest req, StaplerResponse rsp) {
          final String thruVerParam = req.getParameter("thruVer");
          final VersionNumber thruVer = thruVerParam.equals("all") ? null : new VersionNumber(thruVerParam);
  
          saveAndRemoveEntries(new Predicate<Map.Entry<SaveableReference, VersionRange>>() {
              @Override
              public boolean apply(Map.Entry<SaveableReference, VersionRange> entry) {
                  VersionNumber version = entry.getValue().max;
                  return version != null && (thruVer == null || !version.isNewerThan(thruVer));
              }
          });
  
          return HttpResponses.forwardToPreviousPage();
      }
docs: Save all or some of the files to persist data in the new forms.
  Remove those items from the data map.