21 lines
806 B
SQL
21 lines
806 B
SQL
ALTER TABLE "AuthSettings"
|
|
ADD COLUMN IF NOT EXISTS "isEmailVerificationEnabled" boolean NOT NULL DEFAULT false;
|
|
|
|
ALTER TABLE "AuthSettings"
|
|
ADD COLUMN IF NOT EXISTS "emailVerificationExpiresMinutes" integer NOT NULL DEFAULT 10;
|
|
|
|
CREATE TABLE IF NOT EXISTS "EmailVerificationCode" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"email" varchar(64) NOT NULL,
|
|
"purpose" varchar(32) NOT NULL DEFAULT 'register',
|
|
"codeHash" varchar(128) NOT NULL,
|
|
"expiresAt" timestamp NOT NULL,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS "EmailVerificationCode_email_purpose_createdAt_idx"
|
|
ON "EmailVerificationCode" ("email", "purpose", "createdAt");
|
|
|
|
CREATE INDEX IF NOT EXISTS "EmailVerificationCode_expiresAt_idx"
|
|
ON "EmailVerificationCode" ("expiresAt");
|