def db_ensure_indexes():
    """
    This function ensures that indexes for all the models have been created.

    Note #1: When calling this method database connection already needs to be
    established.

    Note #2: This method blocks until all the index have been created (indexes
    are created in real-time and not in background).
    """
    LOG.debug('Ensuring database indexes...')
    model_classes = get_model_classes()

    for cls in model_classes:
        LOG.debug('Ensuring indexes for model "%s"...' % (cls.__name__))
        cls.ensure_indexes()
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/models/db/__init__.py/db_ensure_indexes/original