Skip to content

Commit 1f20554

Browse files
authored
Merge pull request #5612 from mintsoft/index_cleanup
Cleaning up unused indicies
2 parents 774849c + afb5057 commit 1f20554

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

lib/Migration/Version1000Date20200306161713.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
271271
]);
272272
$table->setPrimaryKey(['id']);
273273
$table->addIndex(['participant'], 'deck_assigned_users_idx_p');
274-
$table->addIndex(['card_id'], 'deck_assigned_users_idx_c');
274+
//$table->addIndex(['card_id'], 'deck_assigned_users_idx_c');
275275
}
276276

277277
if (!$schema->hasTable('deck_board_acl')) {
@@ -307,7 +307,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
307307
]);
308308
$table->setPrimaryKey(['id']);
309309
$table->addUniqueIndex(['board_id', 'type', 'participant'], 'deck_board_acl_uq_i');
310-
$table->addIndex(['board_id'], 'deck_board_acl_idx_i');
310+
//$table->addIndex(['board_id'], 'deck_board_acl_idx_i');
311311
}
312312
return $schema;
313313
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
4+
* SPDX-License-Identifier: AGPL-3.0-or-later
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
10+
namespace OCA\Deck\Migration;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\Migration\IOutput;
15+
use OCP\Migration\SimpleMigrationStep;
16+
17+
class Version11000Date20240222115515 extends SimpleMigrationStep {
18+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
19+
$schema = $schemaClosure();
20+
$returnValue = null;
21+
22+
$assignedUsersTable = $schema->getTable('deck_assigned_users');
23+
if($assignedUsersTable->hasIndex('deck_assigned_users_idx_c')) {
24+
$assignedUsersTable->dropIndex('deck_assigned_users_idx_c');
25+
$returnValue = $schema;
26+
}
27+
28+
$boardAclTable = $schema->getTable('deck_board_acl');
29+
if($boardAclTable->hasIndex('deck_board_acl_idx_i')) {
30+
$boardAclTable->dropIndex('deck_board_acl_idx_i');
31+
$returnValue = $schema;
32+
}
33+
return $returnValue;
34+
}
35+
}

0 commit comments

Comments
 (0)