瀏覽代碼

Add missing index for propertypath only queries against properties

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tags/v24.0.0beta1
Christoph Wurst 2 年之前
父節點
當前提交
ed84f07784
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 17 行新增0 行删除
  1. 3
    0
      core/Application.php
  2. 13
    0
      core/Command/Db/AddMissingIndices.php
  3. 1
    0
      core/Migrations/Version13000Date20170718121200.php

+ 3
- 0
core/Application.php 查看文件

@@ -195,6 +195,9 @@ class Application extends App {
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')) {

+ 13
- 0
core/Command/Db/AddMissingIndices.php 查看文件

@@ -316,11 +316,24 @@ class AddMissingIndices extends Command {
$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>');
}

+ 1
- 0
core/Migrations/Version13000Date20170718121200.php 查看文件

@@ -363,6 +363,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
$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')) {

Loading…
取消
儲存