summaryrefslogtreecommitdiffstats
path: root/lib/private/db/migrator.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/db/migrator.php')
-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);
}