Better Auth - Schema + Compatibility - #4284
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds Better Auth-compatible Prisma fields and models. It updates the authentication adapter and password reset flow to persist ChangesAuthentication verification support
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/lib/auth/options.ts`:
- Around line 67-70: Update the emailVerified update object so that whenever
emailVerified !== undefined, it also assigns emailVerifiedBa to
Boolean(emailVerified), including when verification is cleared with null; remove
the conditional true-only assignment while preserving the surrounding update
flow.
In `@apps/web/prisma/schema/schema.prisma`:
- Around line 15-16: Backfill Better Auth verification for existing verified
users: add a Prisma database migration updating User rows with non-null
emailVerified so emailVerifiedBa is true, and update existing seeded/fixture
users in apps/web/playwright/seed.ts to use equivalent values; no direct change
is required in apps/web/app/api/auth/reset-password/route.ts because the stale
production data is corrected by the migration.
- Around line 92-93: Update the migration for the Account model’s updatedAt
column to populate existing rows with a valid timestamp before enforcing the
required NOT NULL constraint. Preserve the schema’s `@updatedAt` behavior while
ensuring historical Account records receive a value during migration.
- Around line 102-114: Update CustomPrismaAdapter’s session
methods—getSessionAndUser(), createSession(), updateSession(), and
deleteSession()—to map the adapter’s sessionToken and expires values to the
Prisma Session model’s token and expiresAt fields. Ensure all session reads,
inserts, updates, and deletes use the renamed fields while preserving the
existing adapter behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 9ed6a64b-f443-4165-9ede-2bbdaa6b428a
📒 Files selected for processing (7)
apps/web/app/api/auth/reset-password/route.tsapps/web/lib/actions/create-user-account.tsapps/web/lib/auth/options.tsapps/web/playwright/seed.tsapps/web/prisma/schema/schema.prismaapps/web/scripts/dev/seed-partner-enrollment.tsapps/web/scripts/dev/seed.ts
|
@coderabbitai made some changes, review the comments |
|
|
Summary by CodeRabbit
Bug Fixes
Authentication