getTable('jobs'); $table->modifyColumn('argument_hash', [ 'notnull' => false, 'length' => 64, ]); return $schema; } public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $chunkSize = 1000; $offset = 0; $nullHash = hash('sha256', 'null'); $selectQuery = $this->connection->getQueryBuilder() ->select('*') ->from('jobs') ->setMaxResults($chunkSize); $insertQuery = $this->connection->getQueryBuilder(); $insertQuery->update('jobs') ->set('argument_hash', $insertQuery->createParameter('argument_hash')) ->where($insertQuery->expr()->eq('id', $insertQuery->createParameter('id'))); do { $result = $selectQuery ->setFirstResult($offset) ->executeQuery(); $jobs = $result->fetchAll(); $count = count($jobs); foreach ($jobs as $jobRow) { if ($jobRow['argument'] === 'null') { $hash = $nullHash; } else { $hash = hash('sha256', $jobRow['argument']); } $insertQuery->setParameter('id', (string)$jobRow['id'], IQueryBuilder::PARAM_INT); $insertQuery->setParameter('argument_hash', $hash); $insertQuery->executeStatement(); } $offset += $chunkSize; } while ($count === $chunkSize); } }