Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.

def run_migrations_online():
    """
    Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.
    """
    connectable = context.config.attributes.get("connection", None)

    if connectable is None:
        options = context.config.get_section(context.config.config_ini_section)
        url = options.pop("url")
        connectable = create_engine(url, poolclass=pool.NullPool)

    with connectable.connect() as connection:
        context.configure(
            connection=connection,
            target_metadata=db.metadata,
            compare_server_default=True,
        )
        with context.begin_transaction():
            context.run_migrations()