Ejemplo n.º 1
0
def do_upgrade():
    """Implement your upgrades here."""
    from invenio.config import SECRET_KEY
    from sqlalchemy_utils.types.encrypted import AesEngine
    engine = AesEngine()
    engine._update_key(SECRET_KEY)

    for row in run_sql(
            "SELECT id, access_token, refresh_token FROM oauth2TOKEN"):
        run_sql(
            "UPDATE oauth2TOKEN SET access_token=%s, "
            "refresh_token=%s WHERE id=%s", (engine.encrypt(
                row[1]), engine.encrypt(row[2]) if row[2] else None, row[0]))
def do_upgrade():
    """Implement your upgrades here."""
    from invenio.config import SECRET_KEY
    from sqlalchemy_utils.types.encrypted import AesEngine
    engine = AesEngine()
    engine._update_key(SECRET_KEY)
    for row in run_sql("SELECT id_remote_account, token_type, access_token "
                       "FROM remoteTOKEN"):
        run_sql(
            "UPDATE remoteTOKEN SET access_token=%s "
            "WHERE id_remote_account=%s AND "
            "token_type=%s", (engine.encrypt(row[2]), row[0], row[1]))
def do_upgrade():
    """Implement your upgrades here."""
    from invenio.config import SECRET_KEY
    from sqlalchemy_utils.types.encrypted import AesEngine
    engine = AesEngine()
    engine._update_key(SECRET_KEY)
    for row in run_sql(
            "SELECT id_remote_account, token_type, access_token "
            "FROM remoteTOKEN"):
        run_sql(
            "UPDATE remoteTOKEN SET access_token=%s "
            "WHERE id_remote_account=%s AND "
            "token_type=%s", (engine.encrypt(row[2]), row[0], row[1]))
def do_upgrade():
    """Implement your upgrades here."""
    from invenio.config import SECRET_KEY
    from sqlalchemy_utils.types.encrypted import AesEngine
    engine = AesEngine()
    engine._update_key(SECRET_KEY)

    for row in run_sql(
            "SELECT id, access_token, refresh_token FROM oauth2TOKEN"):
        run_sql(
            "UPDATE oauth2TOKEN SET access_token=%s, "
            "refresh_token=%s WHERE id=%s",
            (engine.encrypt(row[1]),
             engine.encrypt(row[2]) if row[2] else None,
             row[0]))