Only rollback when not MySQL
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
3cdfe7b0f4
commit
2d34ca4143
|
@ -10,7 +10,9 @@
|
||||||
namespace Test\DB;
|
namespace Test\DB;
|
||||||
|
|
||||||
use Doctrine\DBAL\Exception;
|
use Doctrine\DBAL\Exception;
|
||||||
|
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
||||||
use Doctrine\DBAL\Platforms\OraclePlatform;
|
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||||
|
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Doctrine\DBAL\Schema\SchemaConfig;
|
use Doctrine\DBAL\Schema\SchemaConfig;
|
||||||
use OC\DB\SchemaWrapper;
|
use OC\DB\SchemaWrapper;
|
||||||
|
@ -122,7 +124,11 @@ class MigratorTest extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isSQLite() {
|
private function isSQLite() {
|
||||||
return $this->connection->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver;
|
return $this->connection->getDatabasePlatform() instanceof SqlitePlatform;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function isMySQL() {
|
||||||
|
return $this->connection->getDatabasePlatform() instanceof MySQLPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,7 +149,9 @@ class MigratorTest extends \Test\TestCase {
|
||||||
try {
|
try {
|
||||||
$migrator->migrate($endSchema);
|
$migrator->migrate($endSchema);
|
||||||
} catch (Exception\UniqueConstraintViolationException $e) {
|
} catch (Exception\UniqueConstraintViolationException $e) {
|
||||||
$this->connection->rollBack();
|
if (!$this->isMySQL()) {
|
||||||
|
$this->connection->rollBack();
|
||||||
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue