only commit in case a transaction is active

This commit is contained in:
Thomas Müller 2014-07-23 20:13:19 +02:00
parent a547bf8fe6
commit 363ba04f5e
1 changed files with 3 additions and 1 deletions

View File

@ -110,7 +110,9 @@ class Migrator {
$this->dropTable($tmpName);
} catch (DBALException $e) {
// pgsql needs to commit it's failed transaction before doing anything else
$this->connection->commit();
if ($this->connection->isTransactionActive()) {
$this->connection->commit();
}
$this->dropTable($tmpName);
throw new MigrationException($table->getName(), $e->getMessage());
}