diff options
author | Joas Schilling <coding@schilljs.com> | 2020-04-02 15:50:21 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-04-02 15:50:21 +0300 |
commit | 299f440cdbf7feebafa466b6a021c75639493cb3 (patch) | |
tree | 9a8ef4b5e4e41ea97e576134287f3257a9e00f7a /lib/Migration | |
parent | 7c510ba7de827bc647f7809f749f69ea9b513143 (diff) |
Add a user index on the participants table
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Migration')
-rw-r--r-- | lib/Migration/Version8000Date20200402124456.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/Migration/Version8000Date20200402124456.php b/lib/Migration/Version8000Date20200402124456.php new file mode 100644 index 000000000..adff00243 --- /dev/null +++ b/lib/Migration/Version8000Date20200402124456.php @@ -0,0 +1,45 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020, Joas Schilling <coding@schilljs.com> + * + * @author Joas Schilling <coding@schilljs.com> + * + * @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\Talk\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version8000Date20200402124456 extends SimpleMigrationStep { + + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + $table = $schema->getTable('talk_participants'); + if (!$table->hasIndex('tp_uid')) { + $table->addIndex(['user_id'], 'tp_uid'); + } + + return $schema; + } +} |