Skip to content

Commit 3ac45f5

Browse files
committed
fix(Migration): Don't error on large tables
Signed-off-by: Marcel Klehr <[email protected]>
1 parent 0c41354 commit 3ac45f5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/Migration/Version010000001Date20250727094721.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,19 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
6060
return;
6161
}
6262

63+
$select = $this->db->getQueryBuilder();
64+
$select->select('id')
65+
->from('recognize_face_detections')
66+
->where($select->expr()->isNull('face_vector'))
67+
->setMaxResults(1000);
68+
6369
$query = $this->db->getQueryBuilder();
6470
$query->update('recognize_face_detections')
65-
->set('face_vector', 'vector');
66-
$query->executeStatement();
71+
->set('face_vector', 'vector')
72+
->where($query->expr()->in('id', $query->createFunction('(' . $select->getSQL() .')')));
73+
74+
do {
75+
$updatedRows = $query->executeStatement();
76+
} while ($updatedRows > 0);
6777
}
6878
}

0 commit comments

Comments
 (0)