From ffdd4f94962ff38daabe229505073e5595d33486 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 2 Nov 2026 07:56:47 -0500 Subject: [PATCH] perf: Add userId index to oauth_authentications (#14444) --- ...dd-user-id-index-to-oauth-authentications.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 server/migrations/20261102120000-add-user-id-index-to-oauth-authentications.js diff --git a/server/migrations/20261102120000-add-user-id-index-to-oauth-authentications.js b/server/migrations/20261102120000-add-user-id-index-to-oauth-authentications.js new file mode 100644 index 0000000000..a211740f13 --- /dev/null +++ b/server/migrations/20261102120000-add-user-id-index-to-oauth-authentications.js @@ -0,0 +1,17 @@ +"use strict"; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface) { + // Covers listing a user's authentications and cascade deletes of users. + await queryInterface.sequelize.query( + 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "oauth_authentications_user_id" ON "oauth_authentications" ("userId");' + ); + }, + + async down(queryInterface) { + await queryInterface.sequelize.query( + 'DROP INDEX CONCURRENTLY IF EXISTS "oauth_authentications_user_id";' + ); + }, +};