Extract schema creation code into its own method.
This commit is contained in:
parent
370593361b
commit
56b6504d59
1 changed files with 13 additions and 9 deletions
|
@ -123,15 +123,7 @@ class ConvertType extends Command {
|
|||
$this->clearSchema($toDB->getSchemaManager(), $input, $output);
|
||||
}
|
||||
|
||||
$output->writeln('<info>Creating schema in new database</info>');
|
||||
$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');
|
||||
}
|
||||
}
|
||||
$this->createSchema($toDB, $input, $output);
|
||||
|
||||
$toTables = $this->getTables($toDB);
|
||||
$fromTables = $this->getTables($fromDB);
|
||||
|
@ -154,6 +146,18 @@ class ConvertType extends Command {
|
|||
$this->convertDB($fromDB, $toDB, $tables, $input, $output);
|
||||
}
|
||||
|
||||
protected function createSchema(Connection $toDB, InputInterface $input, OutputInterface $output) {
|
||||
$output->writeln('<info>Creating schema in new database</info>');
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function getToDBConnection(InputInterface $input, OutputInterface $output) {
|
||||
$type = $input->getArgument('type');
|
||||
$connectionParams = array(
|
||||
|
|
Loading…
Reference in a new issue