From 1d56b5276100bffa50d2fb575f498f297c5048d4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 19 Jul 2017 11:48:58 +0200 Subject: [PATCH] Use migrations on convert Signed-off-by: Joas Schilling --- core/Command/Db/ConvertType.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index 16864e57db..7f17950ad6 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -28,6 +28,7 @@ namespace OC\Core\Command\Db; +use OC\DB\MigrationService; use OCP\DB\QueryBuilder\IQueryBuilder; use \OCP\IConfig; use OC\DB\Connection; @@ -219,12 +220,18 @@ class ConvertType extends Command implements CompletionAwareInterface { protected function createSchema(Connection $toDB, InputInterface $input, OutputInterface $output) { $output->writeln('Creating schema in new database'); + + $ms = new MigrationService('core', $toDB); + $ms->migrate(); // FIXME should only migrate to the current version? + $schemaManager = new \OC\DB\MDB2SchemaManager($toDB); - $schemaManager->createDbFromStructure(\OC::$SERVERROOT.'/db_structure.xml'); $apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps(); foreach($apps as $app) { 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? } } }