lib/Doctrine/CouchDB/Tools/Migrations/AbstractMigration.php
public function execute()
    {
        $response = $this->client->allDocs(100);
        $lastKey = null;

        do {
            if ($response->status !== 200) {
                throw new \RuntimeException('Error while migrating at offset '.$offset);
            }

            $bulkUpdater = $this->client->createBulkUpdater();
            foreach ($response->body['rows'] as $row) {
                $doc = $this->migrate($row['doc']);
                if ($doc) {
                    $bulkUpdater->updateDocument($doc);
                }
                $lastKey = $row['key'];
            }

            $bulkUpdater->execute();
            $response = $this->client->allDocs(100, $lastKey);
        } while (count($response->body['rows']) > 1);
    }
public function execute()
    {
        $response = $this->client->allDocs(100);
        $lastKey = null;

        do {
            if ($response->status !== 200) {
                throw new \RuntimeException('Error while migrating at offset '.$offset);
            }

            $bulkUpdater = $this->client->createBulkUpdater();
            foreach ($response->body['rows'] as $row) {
                $doc = $this->migrate($row['doc']);
                if ($doc) {
                    $bulkUpdater->updateDocument($doc);
                }
                $lastKey = $row['key'];
            }

            $bulkUpdater->execute();
            $response = $this->client->allDocs(100, $lastKey);
        } while (count($response->body['rows']) > 1);
    }
public function execute ( ) { $ response = $ this -> client -> allDocs ( 100 ) ; $ lastKey = null ; do { if ( $ response -> status !== 200 ) { throw new \ RuntimeException ( 'Error while migrating at offset ' . $ offset ) ; } $ bulkUpdater = $ this -> client -> createBulkUpdater ( ) ; foreach ( $ response -> body [ 'rows' ] as $ row ) { $ doc = $ this -> migrate ( $ row [ 'doc' ] ) ; if ( $ doc ) { $ bulkUpdater -> updateDocument ( $ doc ) ; } $ lastKey = $ row [ 'key' ] ; } $ bulkUpdater -> execute ( ) ; $ response = $ this -> client -> allDocs ( 100 , $ lastKey ) ; } while ( count ( $ response -> body [ 'rows' ] ) > 1 ) ; }
Execute migration by iterating over all documents in batches of 100.

@throws \RuntimeException

@return void
Execute migration by iterating over all documents in batches of 100 .