Pass Connection instead of AbstractSchemaManager to clearSchema().
This commit is contained in:
parent
f1d05d204e
commit
0a78fb49f5
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
namespace OC\Core\Command\Db;
|
namespace OC\Core\Command\Db;
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
|
||||||
|
|
||||||
use OC\Config;
|
use OC\Config;
|
||||||
use OC\DB\Connection;
|
use OC\DB\Connection;
|
||||||
use OC\DB\ConnectionFactory;
|
use OC\DB\ConnectionFactory;
|
||||||
|
@ -156,7 +154,7 @@ class ConvertType extends Command {
|
||||||
$toDB = $this->getToDBConnection($input, $output);
|
$toDB = $this->getToDBConnection($input, $output);
|
||||||
|
|
||||||
if ($input->getOption('clear-schema')) {
|
if ($input->getOption('clear-schema')) {
|
||||||
$this->clearSchema($toDB->getSchemaManager(), $input, $output);
|
$this->clearSchema($toDB, $input, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->createSchema($toDB, $input, $output);
|
$this->createSchema($toDB, $input, $output);
|
||||||
|
@ -214,19 +212,18 @@ class ConvertType extends Command {
|
||||||
return $this->connectionFactory->getConnection($type, $connectionParams);
|
return $this->connectionFactory->getConnection($type, $connectionParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function clearSchema(AbstractSchemaManager $schemaManager, InputInterface $input, OutputInterface $output) {
|
protected function clearSchema(Connection $db, InputInterface $input, OutputInterface $output) {
|
||||||
$toTables = $schemaManager->listTableNames();
|
$toTables = $this->getTables($db);
|
||||||
if (!empty($toTables)) {
|
if (!empty($toTables)) {
|
||||||
$output->writeln('<info>Clearing schema in new database</info>');
|
$output->writeln('<info>Clearing schema in new database</info>');
|
||||||
}
|
}
|
||||||
foreach($toTables as $table) {
|
foreach($toTables as $table) {
|
||||||
$schemaManager->dropTable($table);
|
$db->getSchemaManager()->dropTable($table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTables(Connection $db) {
|
protected function getTables(Connection $db) {
|
||||||
$schemaManager = $db->getSchemaManager();
|
return $db->getSchemaManager()->listTableNames();
|
||||||
return $schemaManager->listTableNames();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function copyTable(Connection $fromDB, Connection $toDB, $table, InputInterface $input, OutputInterface $output) {
|
protected function copyTable(Connection $fromDB, Connection $toDB, $table, InputInterface $input, OutputInterface $output) {
|
||||||
|
|
Loading…
Reference in New Issue