code: def upgrade_db(conn, pkg_name='openquake.server.db.schema.upgrades',
                 skip_versions=()):
      
      upgrader = UpgradeManager.instance(conn, pkg_name)
      t0 = time.time()
      # run the upgrade scripts
      try:
          versions_applied = upgrader.upgrade(conn, skip_versions)
      except:
          conn.rollback()
          raise
      else:
          conn.commit()
      dt = time.time() - t0
      logging.info('Upgrade completed in %s seconds', dt)
      return versions_applied
docs: Upgrade a database by running several scripts in a single transaction.
  
      :param conn: a DB API 2 connection
      :param str pkg_name: the name of the package with the upgrade scripts
      :param list skip_versions: the versions to skip
      :returns: the version numbers of the new scripts applied the database