'Process to schema migrations in column `colname` starting
from `version`.'

def migrate_schema(self, colname, version):

    failed = 0
    while (version in self.schema_migrations[colname]):
        updated = False
        (new_version, migration_function) = self.schema_migrations[colname][version]
        utils.LOGGER.info('Migrating    column    %s    from    version    %r    to    %r', colname, version, new_version)
        for record in self.find(colname, self.searchversion(version)):
            try:
                update = migration_function(record)
            except Exception as exc:
                utils.LOGGER.warning('Cannot    migrate    host    %s    [%s:    %s]', record['_id'], exc.__class__.__name__, exc.message)
                failed += 1
            else:
                if (update is not None):
                    updated = True
                    self.db[colname].update({'_id': record['_id']}, update)
        if updated:
            for (action, indexes) in viewitems(self.schema_migrations_indexes[colname].get(new_version, {})):
                function = getattr(self.db[colname], ('%s_index' % action))
                for idx in indexes:
                    try:
                        function(idx[0], **idx[1])
                    except pymongo.errors.OperationFailure as exc:
                        utils.LOGGER.warning('Cannot    %s    index    %s    [%s:    %s]', action, idx, exc.__class__.__name__, exc.message)
        utils.LOGGER.info('Migration    of    column    %s    from    version    %r    to    %r    DONE', colname, version, new_version)
        version = new_version
    if failed:
        utils.LOGGER.info('Failed    to    migrate    %d    documents', failed)
