'Upgrade the database, if necessary.
It blocks until the upgrade is complete.  Alternatively, if you
want more control over upgrading use:
Database.upgrade_info()
Database.upgrade()
Database.reset()'

def upgrade(self):

    log.debug('upgrade    db    if    necessary')
    (status, reason) = self.db.upgrade_info()
    if (status == Database.UPGRADE_NECESSARY):
        log.info('db    upgrade    is    necessary')
        self.db.upgrade()
    elif (status == Database.UPGRADE_NOT_POSSIBLE):
        log.warn('%s    (resetting    db)', reason)
        log.info("reset    db    at    `%s'    (creating    backup)", self.db.base_dir)
        self.db.reset()
    elif (status == Database.UPGRADE_NOT_NECESSARY):
        log.debug('no    upgrade    necessary')
    else:
        raise CodeIntelError(('unknown    db    upgrade    status:    %r' % status))
