Skip to content

Commit

Permalink
Merge pull request #5612 from mintsoft/index_cleanup
Browse files Browse the repository at this point in the history
Cleaning up unused indicies
  • Loading branch information
juliusknorr authored May 9, 2024
2 parents 774849c + afb5057 commit 1f20554
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Migration/Version1000Date20200306161713.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
]);
$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')) {
Expand Down Expand Up @@ -307,7 +307,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
]);
$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;
}
Expand Down
35 changes: 35 additions & 0 deletions lib/Migration/Version11000Date20240222115515.php
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 1f20554

Please sign in to comment.