if ($lock->
acquire(true
)) { $closure();
$lock->
release();
} } private function applyNewSchema(Schema
$update): void
{ $baseSchema =
$this->connection->
createSchemaManager()->
introspectSchema();
$queries =
$this->
getPlatform()->
getAlterSchemaSQL((new Comparator())->
compareSchemas($baseSchema,
$update));
foreach ($queries as $query) { try { $this->connection->
executeStatement($query);
} catch (Exception
$e) { // there seems to be a timing issue in sql when dropping a foreign key which relates to an index.
// Sometimes the index exists no more when doctrine tries to drop it after dropping the foreign key.
if (!\
str_contains($e->
getMessage(), 'An exception occurred while executing \'DROP INDEX IDX_'
)) { throw $e;
} } }