Skip to content

Commit 6852ac1

Browse files
committed
fix(Migration): Don't use subquery
Signed-off-by: Marcel Klehr <[email protected]>
1 parent caefca5 commit 6852ac1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/Migration/Version010000001Date20250727094721.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
use Closure;
1111
use Doctrine\DBAL\Schema\SchemaException;
1212
use OCP\DB\ISchemaWrapper;
13+
use OCP\DB\QueryBuilder\IQueryBuilder;
1314
use OCP\DB\Types;
1415
use OCP\IDBConnection;
1516
use OCP\Migration\IOutput;
1617
use OCP\Migration\SimpleMigrationStep;
18+
use PDO;
1719

1820
final class Version010000001Date20250727094721 extends SimpleMigrationStep {
1921

@@ -69,10 +71,16 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
6971
$query = $this->db->getQueryBuilder();
7072
$query->update('recognize_face_detections')
7173
->set('face_vector', 'vector')
72-
->where($query->expr()->in('id', $query->createFunction('(' . $select->getSQL() .')')));
74+
->where($query->expr()->in('id', $query->createParameter('ids')));
7375

7476
do {
75-
$updatedRows = $query->executeStatement();
77+
$result = $select->executeQuery();
78+
$ids = $result->fetchAll(PDO::FETCH_COLUMN);
79+
$result->closeCursor();
80+
if (empty($ids)) {
81+
break;
82+
}
83+
$updatedRows = $query->setParameter('ids', $ids, IQueryBuilder::PARAM_INT_ARRAY)->executeStatement();
7684
} while ($updatedRows > 0);
7785
}
7886
}

0 commit comments

Comments
 (0)