Only delete duplicate ids when there are duplicates.

Running a query with an empty IN() is a syntax error
master v0.2.1
Lars Vierbergen 7 years ago
parent 834edefe6d
commit e6ec250cf5
  1. 1
      Resources/migrations/VersionAuthserverExternalAccount20171020220239.php

@ -32,6 +32,7 @@ class VersionAuthserverExternalAccount20171020220239 extends AbstractMigration
$duplicateIds = array_map(function ($row) { $duplicateIds = array_map(function ($row) {
return $row['id']; return $row['id'];
}, $duplicates); }, $duplicates);
if (count($duplicateIds) > 0)
$this->connection->executeUpdate('DELETE FROM vierbergenlars_external_account_external_user WHERE id IN(' . implode(',', $duplicateIds) . ')'); $this->connection->executeUpdate('DELETE FROM vierbergenlars_external_account_external_user WHERE id IN(' . implode(',', $duplicateIds) . ')');
} }