Bladeren bron

Add table for account recovery

Neeraj Gupta 1 jaar geleden
bovenliggende
commit
23fcce245d
2 gewijzigde bestanden met toevoegingen van 20 en 0 verwijderingen
  1. 2 0
      server/migrations/80_account_recovery.down.sql
  2. 18 0
      server/migrations/80_account_recovery.up.sql

+ 2 - 0
server/migrations/80_account_recovery.down.sql

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

+ 18 - 0
server/migrations/80_account_recovery.up.sql

@@ -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();