Speed up access token cleanup with an index

This commit is contained in:
Quentin Gliech committed 2026-01-08 19:03:09 +01:00
1 parent 3e7cb60f63
commit ad360db8fc
1 file changed
+9
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2026 Element Creations Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
-- Please see LICENSE in the repository root for full details.
-- This adds an index on the revoked_at field on oauth2_access_tokens to speed up cleaning them up
CREATE INDEX CONCURRENTLY IF NOT EXISTS oauth_access_tokens_revoked_at_idx
ON oauth2_access_tokens (revoked_at) WHERE revoked_at IS NOT NULL;