Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop redundant indexes #1291

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Folders can be configured from *Group folders* in the admin settings.
After a folder is created, the admin can give access to the folder to one or more groups, control their write/sharing permissions and assign a quota for the folder.

Note: encrypting the contents of group folders is currently not supported.]]></description>
<version>10.0.0</version>
<version>10.0.1</version>
<licence>agpl</licence>
<author>Robin Appelman</author>
<namespace>GroupFolders</namespace>
Expand Down
68 changes: 68 additions & 0 deletions lib/Migration/Version1000000Date20210216085047.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2021 Roeland Jago Douma <roeland@famdouma.nl>
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\GroupFolders\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version1000000Date20210216085047 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

$table = $schema->getTable('group_folders_acl');
if ($table->hasIndex('groups_folder_acl_file')) {
$table->dropIndex('groups_folder_acl_file');
}

$table = $schema->getTable('group_folders_groups');
if ($table->hasIndex('group_folder')) {
$table->dropIndex('group_folder');
}

$table = $schema->getTable('group_folders_trash');
if ($table->hasIndex('groups_folder_trash_folder')) {
$table->dropIndex('groups_folder_trash_folder');
}
if ($table->hasIndex('groups_folder_name')) {
$table->dropIndex('groups_folder_name');
}

return $schema;
}
}
1 change: 0 additions & 1 deletion lib/Migration/Version102020Date20180806161449.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
'length' => 64,
]);
$table->setPrimaryKey(['applicable_id']);
$table->addIndex(['folder_id'], 'group_folder');
$table->addIndex(['group_id'], 'group_folder_value');
$table->addUniqueIndex(['folder_id', 'group_id'], 'groups_folder_group');
}
Expand Down
2 changes: 0 additions & 2 deletions lib/Migration/Version104000Date20180918132853.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
'length' => 6,
]);
$table->setPrimaryKey(['trash_id']);
$table->addIndex(['folder_id'], 'groups_folder_trash_folder');
$table->addIndex(['folder_id', 'name'], 'groups_folder_name');
$table->addUniqueIndex(['folder_id', 'name', 'deleted_time'], 'groups_folder_trash_unique');
}

Expand Down
1 change: 0 additions & 1 deletion lib/Migration/Version201000Date20190111132839.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
'notnull' => true,
]);
$table->setPrimaryKey(['acl_id']);
$table->addIndex(['fileid'], 'groups_folder_acl_file');
$table->addIndex(['mapping_type', 'mapping_id'], 'groups_folder_acl_mapping');
$table->addUniqueIndex(['fileid', 'mapping_type', 'mapping_id'], 'groups_folder_acl_unique');
}
Expand Down