def METHOD_NAME():
    """Run migrations in 'online' mode.
    In this scenario we need to create an Engine
    and associate a connection with the context.
    """
    # for the direct-to-DB use case, start a transaction on all
    # engines, then run all migrations, then commit all transactions.
    engines = {}
    for name in re.split(r",\s*", db_names):
        engines[name] = rec = {}
        rec["engine"] = DBEngineManager().make_engine(name)
    for name, rec in engines.items():
        engine = rec["engine"]
        rec["connection"] = conn = engine.connect()
        if USE_TWOPHASE:
            rec["transaction"] = conn.begin_twophase()
        else:
            rec["transaction"] = conn.begin()
    try:
        for name, rec in engines.items():
            logger.info("Migrating database %s", name)
            context.configure(
                connection=rec["connection"],
                upgrade_token=f"{name}_upgrades",
                downgrade_token=f"{name}_downgrades",
                target_metadata=target_metadata.get(name),
                version_table=f"alembic_version_{name}",
            )
            context.run_migrations(engine_name=name)
        if USE_TWOPHASE:
            for rec in engines.values():
                rec["transaction"].prepare()
        for rec in engines.values():
            rec["transaction"].commit()
    except Exception:
        for rec in engines.values():
            rec["transaction"].rollback()
        raise
    finally:
        for rec in engines.values():
            rec["connection"].close()