feat(club-004): club recovery: recovery codes and device reassignment
This commit is contained in:
19
project/migrations/067_club_recovery_code_index.js
Normal file
19
project/migrations/067_club_recovery_code_index.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* CLUB-004 — Club recovery codes: add index on code_fingerprint.
|
||||
*
|
||||
* The consumeRecoveryCode() flow looks up by fingerprint, which must be fast.
|
||||
*
|
||||
* @param {import('node-pg-migrate').MigrationBuilder} pgm
|
||||
*/
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE INDEX IF NOT EXISTS club_recovery_codes_code_fingerprint_idx
|
||||
ON club_recovery_codes (code_fingerprint)
|
||||
WHERE used_at IS NULL
|
||||
`);
|
||||
};
|
||||
|
||||
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
|
||||
export const down = (pgm) => {
|
||||
pgm.sql('DROP INDEX IF EXISTS club_recovery_codes_code_fingerprint_idx');
|
||||
};
|
||||
Reference in New Issue
Block a user