diff options
author | Joas Schilling <coding@schilljs.com> | 2017-07-19 11:48:58 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-07-25 12:47:39 +0200 |
commit | 1d56b5276100bffa50d2fb575f498f297c5048d4 (patch) | |
tree | db9fc801a7464fc3859f491efeb9196d0e923483 /core/Command | |
parent | 9307aaee498eae9fb0e1b5e802be88c2e572127d (diff) | |
download | nextcloud-server-1d56b5276100bffa50d2fb575f498f297c5048d4.tar.gz nextcloud-server-1d56b5276100bffa50d2fb575f498f297c5048d4.zip |
Use migrations on convert
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command')
-rw-r--r-- | core/Command/Db/ConvertType.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index 16864e57dbc..7f17950ad65 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('<info>Creating schema in new database</info>'); + + $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? } } } |