Skip to content

Commit

Permalink
Merge pull request #30433 from nextcloud/backport/30392/stable23
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jan 7, 2022
2 parents c8702c7 + 3cf98b7 commit 510e99a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ function (GenericEvent $event) use ($container) {
if (!$table->hasIndex('properties_path_index')) {
$subject->addHintForMissingSubject($table->getName(), 'properties_path_index');
}
if (!$table->hasIndex('properties_pathonly_index')) {
$subject->addHintForMissingSubject($table->getName(), 'properties_pathonly_index');
}
}

if ($schema->hasTable('jobs')) {
Expand Down
13 changes: 13 additions & 0 deletions core/Command/Db/AddMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,24 @@ private function addCoreIndexes(OutputInterface $output) {
$output->writeln('<info>Check indices of the oc_properties table.</info>');
if ($schema->hasTable('properties')) {
$table = $schema->getTable('properties');
$propertiesUpdated = false;

if (!$table->hasIndex('properties_path_index')) {
$output->writeln('<info>Adding properties_path_index index to the oc_properties table, this can take some time...</info>');

$table->addIndex(['userid', 'propertypath'], 'properties_path_index');
$this->connection->migrateToSchema($schema->getWrappedSchema());
$propertiesUpdated = true;
}
if (!$table->hasIndex('properties_pathonly_index')) {
$output->writeln('<info>Adding properties_pathonly_index index to the oc_properties table, this can take some time...</info>');

$table->addIndex(['propertypath'], 'properties_pathonly_index');
$this->connection->migrateToSchema($schema->getWrappedSchema());
$propertiesUpdated = true;
}

if ($propertiesUpdated) {
$updated = true;
$output->writeln('<info>oc_properties table updated successfully.</info>');
}
Expand Down
1 change: 1 addition & 0 deletions core/Migrations/Version13000Date20170718121200.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
$table->setPrimaryKey(['id']);
$table->addIndex(['userid'], 'property_index');
$table->addIndex(['userid', 'propertypath'], 'properties_path_index');
$table->addIndex(['propertypath'], 'properties_pathonly_index');
} else {
$table = $schema->getTable('properties');
if ($table->hasColumn('propertytype')) {
Expand Down

0 comments on commit 510e99a

Please sign in to comment.