Skip to content

Commit 52c2f93

Browse files
Merge pull request #2147 from nextcloud/enh/stable23/index-session-lastcontact
[stable23] Add index for last_contact in text_sessions table
2 parents 409ad92 + 86c4fbe commit 52c2f93

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- **💾 Open format:** Files are saved as [Markdown](https://en.wikipedia.org/wiki/Markdown), so you can edit them from any other text app too.
1212
- **✊ Strong foundation:** We use [🐈 tiptap](https://tiptap.scrumpy.io) which is based on [🦉 ProseMirror](https://prosemirror.net) – huge thanks to them!
1313
]]></description>
14-
<version>3.4.0</version>
14+
<version>3.4.1</version>
1515
<licence>agpl</licence>
1616
<author mail="jus@bitgrid.net">Julius Härtl</author>
1717
<namespace>Text</namespace>

lib/Migration/Version010000Date20190617184535.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
101101
]);
102102
$table->setPrimaryKey(['id']);
103103
$table->addIndex(['token'], 'rd_session_token_idx');
104+
$table->addIndex(['last_contact'], 'ts_lastcontact');
104105
}
105106

106107
if (!$schema->hasTable('text_steps')) {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace OCA\Text\Migration;
6+
7+
use Closure;
8+
use OCP\DB\ISchemaWrapper;
9+
use OCP\Migration\IOutput;
10+
use OCP\Migration\SimpleMigrationStep;
11+
12+
/**
13+
* Auto-generated migration step: Please modify to your needs!
14+
*/
15+
class Version030401Date20220203141002 extends SimpleMigrationStep {
16+
17+
/**
18+
* @param IOutput $output
19+
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
20+
* @param array $options
21+
* @return null|ISchemaWrapper
22+
*/
23+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
24+
/** @var ISchemaWrapper $schema */
25+
$schema = $schemaClosure();
26+
27+
$table = $schema->getTable('text_sessions');
28+
if (!$table->hasIndex('ts_lastcontact')) {
29+
$table->addIndex(['last_contact'], 'ts_lastcontact');
30+
return $schema;
31+
}
32+
33+
return null;
34+
}
35+
}

0 commit comments

Comments
 (0)