diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2022-02-02 12:25:31 +0300 |
---|---|---|
committer | Julien Veyssier <eneiluj@posteo.net> | 2022-02-03 15:58:06 +0300 |
commit | 8785d5e93415edc7c8e26a2ce1e11f723f725b34 (patch) | |
tree | eac0243d6e8d5aaece6765fe6b24df0c72190989 /lib | |
parent | 3d63d45c71bdb9b529e4df086e1fed72de5ae463 (diff) |
add index for last_contact in text_sessions table
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Migration/Version010000Date20190617184535.php | 1 | ||||
-rw-r--r-- | lib/Migration/Version030501Date20220202101853.php | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/lib/Migration/Version010000Date20190617184535.php b/lib/Migration/Version010000Date20190617184535.php index d71bc9d0e..aaafc1182 100644 --- a/lib/Migration/Version010000Date20190617184535.php +++ b/lib/Migration/Version010000Date20190617184535.php @@ -101,6 +101,7 @@ class Version010000Date20190617184535 extends SimpleMigrationStep { ]); $table->setPrimaryKey(['id']); $table->addIndex(['token'], 'rd_session_token_idx'); + $table->addIndex(['last_contact'], 'ts_lastcontact'); } if (!$schema->hasTable('text_steps')) { diff --git a/lib/Migration/Version030501Date20220202101853.php b/lib/Migration/Version030501Date20220202101853.php new file mode 100644 index 000000000..dcdede67e --- /dev/null +++ b/lib/Migration/Version030501Date20220202101853.php @@ -0,0 +1,35 @@ +<?php + +declare(strict_types=1); + +namespace OCA\Text\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 Version030501Date20220202101853 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) { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + $table = $schema->getTable('text_sessions'); + if (!$table->hasIndex('ts_lastcontact')) { + $table->addIndex(['last_contact'], 'ts_lastcontact'); + return $schema; + } + + return null; + } +} |