Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "passwordHash" TEXT;

-- CreateTable
CREATE TABLE "PasswordResetToken" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"token" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

CONSTRAINT "PasswordResetToken_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "PasswordResetToken_token_key" ON "PasswordResetToken"("token");

-- CreateIndex
CREATE INDEX "PasswordResetToken_email_idx" ON "PasswordResetToken"("email");

-- CreateIndex
CREATE UNIQUE INDEX "PasswordResetToken_email_token_key" ON "PasswordResetToken"("email", "token");
12 changes: 12 additions & 0 deletions apps/web/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ model User {
email String? @unique
emailVerified DateTime?
image String?
passwordHash String? // nullable for OAuth-only users
isBetaUser Boolean @default(false)
isWaitlisted Boolean @default(false)
createdAt DateTime @default(now())
Expand All @@ -92,6 +93,17 @@ model User {
teamUsers TeamUser[]
}

model PasswordResetToken {
id String @id @default(cuid())
email String
token String @unique
expires DateTime
createdAt DateTime @default(now())

@@unique([email, token])
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PasswordResetToken model is missing an index on the expires field. This field is frequently queried for validation (checking if tokens have expired) and would benefit from an index to optimize these lookups. Additionally, a periodic cleanup job that deletes expired tokens would also benefit from this index.

Consider adding @@index([expires]) to improve query performance for expiration checks and cleanup operations.

Suggested change
@@unique([email, token])
@@unique([email, token])
@@index([expires])

Copilot uses AI. Check for mistakes.
@@index([email])
}

enum Plan {
FREE
BASIC
Expand Down
Loading