mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 20:27:44 +00:00
docs(next-auth-migration-guide): update db mapping (#1872)
This commit is contained in:
@@ -35,8 +35,8 @@ export const auth = betterAuth({
|
||||
// Other configs
|
||||
session: {
|
||||
fields: {
|
||||
expiresAt: "expires", // e.g., "expires_at" or your existing field name
|
||||
token: "sessionToken" // e.g., "session_token" or your existing field name
|
||||
expiresAt: "expires", // Map your existing `expires` field to Better Auth's `expiresAt`
|
||||
token: "sessionToken" // Map your existing `sessionToken` field to Better Auth's `token`
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -76,8 +76,8 @@ export const auth = betterAuth({
|
||||
```prisma title="schema.prisma"
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
expires DateTime @map("expiresAt") // Map `expires` to your existing field
|
||||
token String @map("sessionToken") // Map `token` to your existing field
|
||||
expiresAt DateTime @map("expires") // Map your existing `expires` field to Better Auth's `expiresAt`
|
||||
token String @map("sessionToken") // Map your existing `sessionToken` field to Better Auth's `token`
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user