aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2014-01-11 12:25:35 +0100
committerBart Visscher <bartv@thisnet.nl>2014-01-11 12:25:35 +0100
commit2638fd47674deaeb630b87f01a46ad94446a2097 (patch)
treea61c7f38e9b835b5617f8ba2687661162000be3f /core
parentaf3bedf9858b117b676c915829229fb8745a5e36 (diff)
downloadnextcloud-server-2638fd47674deaeb630b87f01a46ad94446a2097.tar.gz
nextcloud-server-2638fd47674deaeb630b87f01a46ad94446a2097.zip
Postgresql needs the sequences adjusted after the inserts
Diffstat (limited to 'core')
-rw-r--r--core/command/db/convertfromsqlite.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/command/db/convertfromsqlite.php b/core/command/db/convertfromsqlite.php
index 4d5122ca2d7..cd3e494d7f2 100644
--- a/core/command/db/convertfromsqlite.php
+++ b/core/command/db/convertfromsqlite.php
@@ -179,6 +179,18 @@ class ConvertFromSqlite extends Command {
$output->writeln($table);
$this->copyTable($fromDB, $toDB, $table, $output);
}
+ if ($type == 'pgsql') {
+ $sequences = $toDB->getSchemaManager()->listSequences();
+ foreach($sequences as $sequence) {
+ $info = $toDB->fetchAssoc('SELECT table_schema, table_name, column_name '
+ .'FROM information_schema.columns '
+ .'WHERE column_default = ? AND table_catalog = ?',
+ array("nextval('".$sequence->getName()."'::regclass)", $dbname));
+ $table_name = $info['table_name'];
+ $column_name = $info['column_name'];
+ $toDB->executeQuery("SELECT setval('" . $sequence->getName() . "', (SELECT MAX(" . $column_name . ") FROM " . $table_name . ")+1)");
+ }
+ }
// save new database config
$dbhost = $hostname;
if ($input->getOption('port')) {