summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-24 10:00:38 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-24 10:00:38 +0200
commit1d1cb7932157dc0b61578c41fc9040911528fcbb (patch)
tree0bcd854451de77d198cdff34367b0c57884c57f9 /lib
parentadcf942901fd567d97dbe105e8f3dfb7cea738e3 (diff)
parent01aedbe506a1a7a861a0b4342ce01db23986da12 (diff)
downloadnextcloud-server-1d1cb7932157dc0b61578c41fc9040911528fcbb.tar.gz
nextcloud-server-1d1cb7932157dc0b61578c41fc9040911528fcbb.zip
Merge pull request #23395 from owncloud/mysql-check-speedup
Speedup schema cloning for MySQL
Diffstat (limited to 'lib')
-rw-r--r--lib/private/DB/MySQLMigrator.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/private/DB/MySQLMigrator.php b/lib/private/DB/MySQLMigrator.php
index 1b3f70a817d..7e1194865f8 100644
--- a/lib/private/DB/MySQLMigrator.php
+++ b/lib/private/DB/MySQLMigrator.php
@@ -24,6 +24,7 @@
namespace OC\DB;
use Doctrine\DBAL\Schema\Schema;
+use Doctrine\DBAL\Schema\Table;
class MySQLMigrator extends Migrator {
/**
@@ -48,4 +49,26 @@ class MySQLMigrator extends Migrator {
return $schemaDiff;
}
+
+ /**
+ * Speed up migration test by disabling autocommit and unique indexes check
+ *
+ * @param \Doctrine\DBAL\Schema\Table $table
+ * @throws \OC\DB\MigrationException
+ */
+ protected function checkTableMigrate(Table $table) {
+ $this->connection->exec('SET autocommit=0');
+ $this->connection->exec('SET unique_checks=0');
+
+ try {
+ parent::checkTableMigrate($table);
+ } catch (\Exception $e) {
+ $this->connection->exec('SET unique_checks=1');
+ $this->connection->exec('SET autocommit=1');
+ throw new MigrationException($table->getName(), $e->getMessage());
+ }
+ $this->connection->exec('SET unique_checks=1');
+ $this->connection->exec('SET autocommit=1');
+ }
+
}