diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 60f9b65cd5fdd..250fdd4210c10 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -658,6 +658,9 @@ public function ensureOracleConstraints(Schema $sourceSchema, Schema $targetSche public function ensureUniqueNamesConstraints(Schema $targetSchema): void { $constraintNames = []; + /** @var LoggerInterface $logger */ + $logger = \OC::$server->get(LoggerInterface::class); + $sequences = $targetSchema->getSequences(); foreach ($targetSchema->getTables() as $table) { @@ -668,14 +671,14 @@ public function ensureUniqueNamesConstraints(Schema $targetSchema): void { } if (isset($constraintNames[$thing->getName()])) { - throw new \InvalidArgumentException('Index name "' . $thing->getName() . '" for table "' . $table->getName() . '" collides with the constraint on table "' . $constraintNames[$thing->getName()] . '".'); + $logger->error('Index name "' . $thing->getName() . '" for table "' . $table->getName() . '" collides with the constraint on table "' . $constraintNames[$thing->getName()] . '".'); } $constraintNames[$thing->getName()] = $table->getName(); } foreach ($table->getForeignKeys() as $thing) { if (isset($constraintNames[$thing->getName()])) { - throw new \InvalidArgumentException('Foreign key name "' . $thing->getName() . '" for table "' . $table->getName() . '" collides with the constraint on table "' . $constraintNames[$thing->getName()] . '".'); + $logger->error('Foreign key name "' . $thing->getName() . '" for table "' . $table->getName() . '" collides with the constraint on table "' . $constraintNames[$thing->getName()] . '".'); } $constraintNames[$thing->getName()] = $table->getName(); } @@ -688,7 +691,7 @@ public function ensureUniqueNamesConstraints(Schema $targetSchema): void { } if (isset($constraintNames[$indexName])) { - throw new \InvalidArgumentException('Primary index name "' . $indexName . '" for table "' . $table->getName() . '" collides with the constraint on table "' . $constraintNames[$thing->getName()] . '".'); + $logger->error('Primary index name "' . $indexName . '" for table "' . $table->getName() . '" collides with the constraint on table "' . $constraintNames[$thing->getName()] . '".'); } $constraintNames[$indexName] = $table->getName(); } @@ -696,7 +699,7 @@ public function ensureUniqueNamesConstraints(Schema $targetSchema): void { foreach ($sequences as $sequence) { if (isset($constraintNames[$sequence->getName()])) { - throw new \InvalidArgumentException('Sequence name "' . $sequence->getName() . '" for table "' . $table->getName() . '" collides with the constraint on table "' . $constraintNames[$thing->getName()] . '".'); + $logger->error('Sequence name "' . $sequence->getName() . '" for table "' . $table->getName() . '" collides with the constraint on table "' . $constraintNames[$thing->getName()] . '".'); } $constraintNames[$sequence->getName()] = 'sequence'; }