summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-03-14 16:28:56 +0100
committerRobin Appelman <icewind@owncloud.com>2014-06-03 11:17:21 +0200
commit35550e8d9a7239c66457fc1533462fd5949d9d2d (patch)
tree911b26c2e8a0175fff18cc557481cd4f122f469f /lib
parent5243562f45716920b1015a431365dc3fc0bbaf45 (diff)
downloadnextcloud-server-35550e8d9a7239c66457fc1533462fd5949d9d2d.tar.gz
nextcloud-server-35550e8d9a7239c66457fc1533462fd5949d9d2d.zip
Fix migrator for postgres
Diffstat (limited to 'lib')
-rw-r--r--lib/private/db/migrator.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/private/db/migrator.php b/lib/private/db/migrator.php
index 63fddd9c28a..3f32e8c603e 100644
--- a/lib/private/db/migrator.php
+++ b/lib/private/db/migrator.php
@@ -81,6 +81,8 @@ class Migrator {
$this->applySchema($schema);
$this->dropTable($tmpName);
} catch (DBALException $e) {
+ // pgsql needs to commit it's failed transaction before doing anything else
+ $this->connection->commit();
$this->dropTable($tmpName);
throw new MigrationException($table->getName(), $e->getMessage());
}
@@ -153,7 +155,7 @@ class Migrator {
$quotedSource = $this->connection->quoteIdentifier($sourceName);
$quotedTarget = $this->connection->quoteIdentifier($targetName);
- $this->connection->exec('CREATE TABLE ' . $quotedTarget . ' LIKE ' . $quotedSource);
+ $this->connection->exec('CREATE TABLE ' . $quotedTarget . ' (LIKE ' . $quotedSource . ')');
$this->connection->exec('INSERT INTO ' . $quotedTarget . ' SELECT * FROM ' . $quotedSource);
}