diff options
author | Joas Schilling <coding@schilljs.com> | 2020-12-07 19:35:01 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-12-07 19:35:01 +0100 |
commit | c1f28f8d357d313b95ebbcc95c7201cc773aa81f (patch) | |
tree | 744f49a3a1ffff9c0128014fc7f52b43649f0e07 /lib/private/DB | |
parent | e02c9ec1bfc7eaabafe640dce87adb5efb013ad0 (diff) | |
download | nextcloud-server-c1f28f8d357d313b95ebbcc95c7201cc773aa81f.tar.gz nextcloud-server-c1f28f8d357d313b95ebbcc95c7201cc773aa81f.zip |
Make debugging migration exceptions easier
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/DB')
-rw-r--r-- | lib/private/DB/MigrationService.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 9c94cbc61fa..27e03318d6b 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -27,6 +27,7 @@ namespace OC\DB; +use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\PostgreSqlPlatform; use Doctrine\DBAL\Schema\Index; @@ -421,7 +422,13 @@ class MigrationService { // read known migrations $toBeExecuted = $this->getMigrationsToExecute($to); foreach ($toBeExecuted as $version) { - $this->executeStep($version, $schemaOnly); + try { + $this->executeStep($version, $schemaOnly); + } catch (DriverException $e) { + // The exception itself does not contain the name of the migration, + // so we wrap it here, to make debugging easier. + throw new \Exception('Database error when running migration ' . $to . ' for app ' . $this->getApp(), 0, $e); + } } } |