code: def db_version(conn, pkg_name='openquake.server.db.schema.upgrades'):
      
      upgrader = UpgradeManager.instance(conn, pkg_name)
      return max(upgrader.get_db_versions(conn))
docs: :param conn: a DB API 2 connection
      :param str pkg_name: the name of the package with the upgrade scripts
      :returns: the current version of the database