Add table for account recovery

This commit is contained in:
Neeraj Gupta 2024-03-05 09:14:39 +05:30 committed by Neeraj Gupta
parent d7854fa6c0
commit 23fcce245d
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,2 @@
DROP TABLE IF NOT EXISTS account_recovery;
DROP TRIGGER IF EXISTS update_account_recovery_updated_at ON account_recovery;

View file

@ -0,0 +1,18 @@
CREATE TABLE IF NOT EXISTS account_recovery (
user_id bigint NOT NULL,
-- if false, the support team team will not be able to reset the MFA for the user
enable_admin_mfa_reset boolean NOT NULL DEFAULT true,
pass_key_reset_key uuid,
pass_key_reset_enc_data jsonb,
twofa_key_reset_key uuid,
twofa_key_reset_enc_data jsonb,
created_at bigint NOT NULL DEFAULT now_utc_micro_seconds(),
updated_at bigint NOT NULL DEFAULT now_utc_micro_seconds()
);
CREATE TRIGGER update_account_recovery_updated_at
BEFORE UPDATE
ON account_recovery
FOR EACH ROW
EXECUTE PROCEDURE
trigger_updated_at_microseconds_column();