Merge pull request #5612 from mintsoft/index_cleanup

Cleaning up unused indicies
This commit is contained in:
Julius Härtl
2024-05-09 13:24:11 +02:00
committed by GitHub
2 changed files with 37 additions and 2 deletions

View File

@@ -271,7 +271,7 @@ class Version1000Date20200306161713 extends SimpleMigrationStep {
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['participant'], 'deck_assigned_users_idx_p');
$table->addIndex(['card_id'], 'deck_assigned_users_idx_c');
//$table->addIndex(['card_id'], 'deck_assigned_users_idx_c');
}
if (!$schema->hasTable('deck_board_acl')) {
@@ -307,7 +307,7 @@ class Version1000Date20200306161713 extends SimpleMigrationStep {
]);
$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['board_id', 'type', 'participant'], 'deck_board_acl_uq_i');
$table->addIndex(['board_id'], 'deck_board_acl_idx_i');
//$table->addIndex(['board_id'], 'deck_board_acl_idx_i');
}
return $schema;
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
declare(strict_types=1);
namespace OCA\Deck\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version11000Date20240222115515 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
$schema = $schemaClosure();
$returnValue = null;
$assignedUsersTable = $schema->getTable('deck_assigned_users');
if($assignedUsersTable->hasIndex('deck_assigned_users_idx_c')) {
$assignedUsersTable->dropIndex('deck_assigned_users_idx_c');
$returnValue = $schema;
}
$boardAclTable = $schema->getTable('deck_board_acl');
if($boardAclTable->hasIndex('deck_board_acl_idx_i')) {
$boardAclTable->dropIndex('deck_board_acl_idx_i');
$returnValue = $schema;
}
return $returnValue;
}
}