Use migrations on convert
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
9307aaee49
commit
1d56b52761
|
@ -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?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue