Skip to content

Commit 0257315

Browse files
committed
Improve error logging on migration failure
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 1e5a879 commit 0257315

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/private/DB/MigrationService.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
*/
2828
namespace OC\DB;
2929

30-
use Doctrine\DBAL\Exception\DriverException;
3130
use Doctrine\DBAL\Platforms\OraclePlatform;
3231
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
3332
use Doctrine\DBAL\Schema\Index;
@@ -424,10 +423,10 @@ public function migrate($to = 'latest', $schemaOnly = false) {
424423
foreach ($toBeExecuted as $version) {
425424
try {
426425
$this->executeStep($version, $schemaOnly);
427-
} catch (DriverException $e) {
426+
} catch (\Exception $e) {
428427
// The exception itself does not contain the name of the migration,
429428
// so we wrap it here, to make debugging easier.
430-
throw new \Exception('Database error when running migration ' . $to . ' for app ' . $this->getApp(), 0, $e);
429+
throw new \Exception('Database error when running migration ' . $version . ' for app ' . $this->getApp() . PHP_EOL. $e->getMessage(), 0, $e);
431430
}
432431
}
433432
}
@@ -607,7 +606,6 @@ public function ensureOracleConstraints(Schema $sourceSchema, Schema $targetSche
607606
// we will NOT detect invalid length if the column is not modified
608607
if (($sourceColumn === null || $sourceColumn->getLength() !== $thing->getLength() || $sourceColumn->getType()->getName() !== Types::STRING)
609608
&& $thing->getLength() > 4000 && $thing->getType()->getName() === Types::STRING) {
610-
var_dump($sourceColumn === null, $sourceColumn->getLength(), $thing->getLength(), $sourceColumn->getName());
611609
throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type String, but exceeding the 4.000 length limit.');
612610
}
613611
}

0 commit comments

Comments
 (0)