Browse Source
Use migrations on convert
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/5772/head
Joas Schilling
8 years ago
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with
8 additions and
1 deletions
-
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?
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|