code: def run():
      
      logfilename = os.path.join(current_app.config['CFG_LOGDIR'],
                                 'invenio_upgrader.log')
      upgrader = InvenioUpgrader()
      logger = upgrader.get_logger(logfilename=logfilename)
  
      try:
          upgrades = upgrader.get_upgrades()
  
          if not upgrades:
              logger.info("All upgrades have been applied.")
              return
  
          logger.info("Following upgrade(s) will be applied:")
  
          for u in upgrades:
              logger.info(" * %s (%s)" % (u.name, u.info))
  
          logger.info("Running pre-upgrade checks...")
          upgrader.pre_upgrade_checks(upgrades)
  
          logger.info("Calculating estimated upgrade time...")
          estimate = upgrader.human_estimate(upgrades)
  
          click.confirm(
              "You are going to upgrade your installation "
              "(estimated time: {0})!".format(estimate), abort=True)
  
          for u in upgrades:
              logger.info("Applying %s (%s)" % (u.name, u.info))
              upgrader.apply_upgrade(u)
  
          logger.info("Running post-upgrade checks...")
          upgrader.post_upgrade_checks(upgrades)
  
          if upgrader.has_warnings():
              logger.warning("Upgrade completed with %s warnings - please check "
                             "log-file for further information:\nless %s"
                             % (upgrader.get_warnings_count(), logfilename))
          else:
              logger.info("Upgrade completed successfully.")
      except RuntimeError as e:
          for msg in e.args:
              logger.error(unicode(msg))
          logger.info("Please check log file for further information:\n"
                      "less %s" % logfilename)
          click.Abort()
docs: Command for applying upgrades.