Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-07-19 14:18:10 +0300
committerJoas Schilling <coding@schilljs.com>2017-07-25 13:49:15 +0300
commit1b7c1ad5c0c3b28efdfbbc0f4e8730dda9963317 (patch)
tree6eed97a5df6c68a47cf1729e65cab4dba38fd99f /core/Command/Db/ConvertType.php
parent10d7cbb71f89b1e5e39a894bda1b0701760224a0 (diff)
Only migrate to the current state
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command/Db/ConvertType.php')
-rw-r--r--core/Command/Db/ConvertType.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php
index f05014936f5..cccba47b4ee 100644
--- a/core/Command/Db/ConvertType.php
+++ b/core/Command/Db/ConvertType.php
@@ -193,7 +193,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
$this->clearSchema($toDB, $input, $output);
}
- $this->createSchema($toDB, $input, $output);
+ $this->createSchema($fromDB, $toDB, $input, $output);
$toTables = $this->getTables($toDB);
$fromTables = $this->getTables($fromDB);
@@ -220,11 +220,15 @@ class ConvertType extends Command implements CompletionAwareInterface {
$this->convertDB($fromDB, $toDB, $intersectingTables, $input, $output);
}
- protected function createSchema(Connection $toDB, InputInterface $input, OutputInterface $output) {
+ protected function createSchema(Connection $fromDB, Connection $toDB, InputInterface $input, OutputInterface $output) {
$output->writeln('<info>Creating schema in new database</info>');
- $ms = new MigrationService('core', $toDB);
- $ms->migrate(); // FIXME should only migrate to the current version?
+ $fromMS = new MigrationService('core', $fromDB);
+ $currentMigration = $fromMS->getMigration('current');
+ if ($currentMigration !== '0') {
+ $toMS = new MigrationService('core', $toDB);
+ $toMS->migrate($currentMigration);
+ }
$schemaManager = new \OC\DB\MDB2SchemaManager($toDB);
$apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps();
@@ -232,8 +236,14 @@ class ConvertType extends Command implements CompletionAwareInterface {
if (file_exists(\OC_App::getAppPath($app).'/appinfo/database.xml')) {
$schemaManager->createDbFromStructure(\OC_App::getAppPath($app).'/appinfo/database.xml');
} else {
- $ms = new MigrationService($app, $toDB);
- $ms->migrate(); // FIXME should only migrate to the current version?
+ // Make sure autoloading works...
+ \OC_App::loadApp($app);
+ $fromMS = new MigrationService($app, $fromDB);
+ $currentMigration = $fromMS->getMigration('current');
+ if ($currentMigration !== '0') {
+ $toMS = new MigrationService($app, $toDB);
+ $toMS->migrate($currentMigration);
+ }
}
}
}