Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-04-07 10:40:43 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2020-04-07 10:40:43 +0300
commitebf3973842235b5ff7471828ebed17efe43ebf92 (patch)
tree636bcc01e2c80e26d0c12698e41d4d49c9098194 /lib/Migration
parent1c47f9ff6287e1286e132d4a5b182120a65870cc (diff)
Add index on the session_id
This is called from time to time as well. Especially on big instances having this proper indexed saves a lot of row scanning. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/Migration')
-rw-r--r--lib/Migration/Version8000Date20200407073807.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/Migration/Version8000Date20200407073807.php b/lib/Migration/Version8000Date20200407073807.php
new file mode 100644
index 000000000..284e81ea6
--- /dev/null
+++ b/lib/Migration/Version8000Date20200407073807.php
@@ -0,0 +1,46 @@
+<?php
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2020, 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\Talk\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version8000Date20200407073807 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_session_id')) {
+ $table->addIndex(['session_id'], 'tp_session_id');
+ }
+
+ return $schema;
+ }
+}