summaryrefslogtreecommitdiffstats
path: root/core/command/db
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2014-04-09 15:45:30 +0200
committerAndreas Fischer <bantu@owncloud.com>2014-04-09 15:45:30 +0200
commit03a3f668676486644a12261eba7e33f227ea960d (patch)
tree2ee2808d6920c6b5a8cbad16bed326faffb7daae /core/command/db
parent3e0858e51f885badb58b4ea3a7666937b3158bff (diff)
downloadnextcloud-server-03a3f668676486644a12261eba7e33f227ea960d.tar.gz
nextcloud-server-03a3f668676486644a12261eba7e33f227ea960d.zip
Move schema clearing to extra method.
Diffstat (limited to 'core/command/db')
-rw-r--r--core/command/db/converttype.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php
index 81a89de97f8..7e65d1fb663 100644
--- a/core/command/db/converttype.php
+++ b/core/command/db/converttype.php
@@ -9,6 +9,8 @@
namespace OC\Core\Command\Db;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
+
use OC\Config;
use OC\DB\Connection;
use OC\DB\ConnectionFactory;
@@ -104,14 +106,7 @@ class ConvertType extends Command {
$toDB = $this->getToDBConnection($input, $output);
if ($input->getOption('clear-schema')) {
- $schemaManager = $toDB->getSchemaManager();
- $toTables = $schemaManager->listTableNames();
- if (!empty($toTables)) {
- $output->writeln('<info>Clearing schema in new database</info>');
- }
- foreach($toTables as $table) {
- $schemaManager->dropTable($table);
- }
+ $this->clearSchema($toDB->getSchemaManager(), $input, $output);
}
$output->writeln('<info>Creating schema in new database</info>');
@@ -160,6 +155,16 @@ class ConvertType extends Command {
return $this->connectionFactory->getConnection($type, $connectionParams);
}
+ protected function clearSchema(AbstractSchemaManager $schemaManager, InputInterface $input, OutputInterface $output) {
+ $toTables = $schemaManager->listTableNames();
+ if (!empty($toTables)) {
+ $output->writeln('<info>Clearing schema in new database</info>');
+ }
+ foreach($toTables as $table) {
+ $schemaManager->dropTable($table);
+ }
+ }
+
protected function getTables(Connection $db) {
$schemaManager = $db->getSchemaManager();
return $schemaManager->listTableNames();