diff --git a/core/Command/Db/AddIndexToShareTable.php b/core/Command/Db/AddMissingIndices.php similarity index 73% rename from core/Command/Db/AddIndexToShareTable.php rename to core/Command/Db/AddMissingIndices.php index cfd5c1871b..314bed8ccb 100644 --- a/core/Command/Db/AddIndexToShareTable.php +++ b/core/Command/Db/AddMissingIndices.php @@ -28,7 +28,15 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class AddIndexToShareTable extends Command { +/** + * Class AddMissingIndices + * + * if you added any new indices to the database, this is the right place to add + * it your update routine for existing instances + * + * @package OC\Core\Command\Db + */ +class AddMissingIndices extends Command { /** @var IDBConnection */ private $connection; @@ -43,11 +51,24 @@ class AddIndexToShareTable extends Command { protected function configure() { $this - ->setName('db:add-index-to-share-table') - ->setDescription('Add a index to share_with at the share table to increase performance'); + ->setName('db:add-missing-indices') + ->setDescription('Add missing indices to the database tables'); } protected function execute(InputInterface $input, OutputInterface $output) { + $this->addShareTableIndicies($output); + + } + + /** + * add missing indices to the share table + * + * @param OutputInterface $output + * @throws \Doctrine\DBAL\Schema\SchemaException + */ + private function addShareTableIndicies(OutputInterface $output) { + + $output->writeln('Check indices of the share table.'); $schema = new SchemaWrapper($this->connection); $updated = false; @@ -64,10 +85,7 @@ class AddIndexToShareTable extends Command { } if (!$updated) { - $output->writeln('All index already existed, nothing to do.'); + $output->writeln('Done.'); } - - return 0; - } } diff --git a/core/register_command.php b/core/register_command.php index e7c33351a7..372d775dc1 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -90,7 +90,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); - $application->add(new OC\Core\Command\Db\AddIndexToShareTable(\OC::$server->getDatabaseConnection())); + $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection())); $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection()));