def upgrade_db(v=None):
    """upgrade database schema to latest version"""
    from_version = db_version(url=db, repository=repo)
    to_version = v
    if to_version is None:
        to_version = version(repository=repo)

    print("Upgrading db from version %d to %d. " % (from_version, to_version))
    print("Schema upgrade ... ")
    upgrade(url=db, repository=repo, version=v)
    print("Data upgrade ... ")
    datamigrations.run_upgrade_scripts(app, from_version, to_version)
    print("Done!")
dataset/ETHPy150Open jkossen/imposter/dbmanage.py/upgrade_db/original