Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Commit 905e716

Browse files
committed
fix(performance): Add index for scanning signinCodes by uid.
1 parent 9fad269 commit 905e716

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

lib/db/patch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
// The expected patch level of the database. Update if you add a new
66
// patch in the ./schema/ directory.
7-
module.exports.level = 88
7+
module.exports.level = 89

lib/db/schema/patch-088-089.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Add an index to walk signinCodes table by uid,
2+
-- which is necessary when deleting an account.
3+
SET NAMES utf8mb4 COLLATE utf8mb4_bin;
4+
5+
CALL assertPatchLevel('88');
6+
7+
CREATE INDEX `signinCodes_uid`
8+
ON `signinCodes` (`uid`)
9+
ALGORITHM = INPLACE LOCK = NONE;
10+
11+
UPDATE dbMetadata SET value = '89' WHERE name = 'schema-patch-level';

lib/db/schema/patch-089-088.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- SET NAMES utf8mb4 COLLATE utf8mb4_bin;
2+
3+
-- DROP INDEX `signinCodes_uid`
4+
-- ON `signinCodes`
5+
-- ALGORITHM=INPLACE, LOCK=NONE;
6+
7+
-- UPDATE dbMetadata SET value = '88' WHERE name = 'schema-patch-level';

0 commit comments

Comments
 (0)