Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add table for account recovery

Neeraj Gupta23fcce245d5c
diff --git a/server/migrations/80_account_recovery.down.sql b/server/migrations/80_account_recovery.down.sql
new file mode 100644
index 0000000000..d5446f1c75
--- /dev/null
+++ b/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;
\ No newline at end of file
diff --git a/server/migrations/80_account_recovery.up.sql b/server/migrations/80_account_recovery.up.sql
new file mode 100644
index 0000000000..bcf8c5e8cb
--- /dev/null
+++ b/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();