diff --git a/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php b/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php index d3eabe06b9f..974a8ada6df 100755 --- a/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php +++ b/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php @@ -419,10 +419,12 @@ private function _migrateSubmissionFiles() { } } - // Delete the rows for old revisions - Capsule::table('submission_files') - ->whereIn('new_file_id', $newFileIdsToDelete) - ->delete(); + // Delete the rows for old revisions (chunked for performance) + foreach (array_chunk($newFileIdsToDelete, 100) as $chunkFileIds) { + Capsule::table('submission_files') + ->whereIn('new_file_id', $chunkFileIds) + ->delete(); + } // Remove all review round files that point to file ids // that don't exist, so that the foreign key can be set