diff options
author | Julien Veyssier <julien-nc@posteo.net> | 2023-09-01 10:34:10 +0200 |
---|---|---|
committer | Julien Veyssier <julien-nc@posteo.net> | 2023-10-05 14:24:02 +0200 |
commit | e944980eb65893ce0ebeeb691bee85734ef8801a (patch) | |
tree | 3bb4f559a7f3cd93bfca8adb014b4b630a469012 /apps | |
parent | ddfc124767a211e4007c11a016633b33a3b1ca76 (diff) | |
download | nextcloud-server-e944980eb65893ce0ebeeb691bee85734ef8801a.tar.gz nextcloud-server-e944980eb65893ce0ebeeb691bee85734ef8801a.zip |
add db index on oauth2_access_tokens's (token_count, created_at)
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/oauth2/lib/Migration/Version011603Date20230620111039.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/oauth2/lib/Migration/Version011603Date20230620111039.php b/apps/oauth2/lib/Migration/Version011603Date20230620111039.php index ddf2739b125..06cc4db5ab3 100644 --- a/apps/oauth2/lib/Migration/Version011603Date20230620111039.php +++ b/apps/oauth2/lib/Migration/Version011603Date20230620111039.php @@ -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; |