mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
add db index on oauth2_access_tokens's (token_count, created_at)
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
parent
ddfc124767
commit
e944980eb6
1 changed files with 6 additions and 3 deletions
|
|
@ -47,20 +47,23 @@ class Version011603Date20230620111039 extends SimpleMigrationStep {
|
|||
if ($schema->hasTable('oauth2_access_tokens')) {
|
||||
$table = $schema->getTable('oauth2_access_tokens');
|
||||
$dbChanged = false;
|
||||
if (!$table->hasColumn('created_at') || !$table->hasColumn('token_count')) {
|
||||
$dbChanged = true;
|
||||
}
|
||||
if (!$table->hasColumn('created_at')) {
|
||||
$table->addColumn('created_at', Types::BIGINT, [
|
||||
'notnull' => true,
|
||||
'default' => 0,
|
||||
]);
|
||||
$dbChanged = true;
|
||||
}
|
||||
if (!$table->hasColumn('token_count')) {
|
||||
$table->addColumn('token_count', Types::BIGINT, [
|
||||
'notnull' => true,
|
||||
'default' => 0,
|
||||
]);
|
||||
$dbChanged = true;
|
||||
}
|
||||
if (!$table->hasIndex('oauth2_tk_c_created_idx')) {
|
||||
$table->addIndex(['token_count', 'created_at'], 'oauth2_tk_c_created_idx');
|
||||
$dbChanged = true;
|
||||
}
|
||||
if ($dbChanged) {
|
||||
return $schema;
|
||||
|
|
|
|||
Loading…
Reference in a new issue