Esempio n. 1
0
def update_if_needed(db_location):
    logger.debug('update_if_needed')
    script_directory = get_script_directory()

    def upgrade(rev, context):
        revision = 'head'
        return script_directory._upgrade_revs(revision, rev)

    context = get_migration_context(db_location, script_directory,
                                    {'fn': upgrade})

    op = Operations(context)
    op._install_proxy()

    with context.begin_transaction():
        context.run_migrations()
    context.connection.close()