From 528887a4a2ea39492dbc8f540dfc1d34da39aa4b Mon Sep 17 00:00:00 2001 From: "cartsnitch-engineer[bot]" <269717931+cartsnitch-engineer[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 03:42:26 +0000 Subject: [PATCH] fix(auth): add session table model mapping for plural table name Better-Auth defaults to singular "session" table name, but our DB uses the plural "sessions" table (created by migration 002). Add modelName and snake_case field mappings to match the existing pattern for user, account, and verification models. Co-authored-by: Stockboy Steve Co-authored-by: Paperclip Co-authored-by: cartsnitch-ceo[bot] <269712056+cartsnitch-ceo[bot]@users.noreply.github.com> --- auth/src/auth.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/auth/src/auth.ts b/auth/src/auth.ts index 1215cdb..eae43b8 100644 --- a/auth/src/auth.ts +++ b/auth/src/auth.ts @@ -36,6 +36,15 @@ export const auth = betterAuth({ }, session: { + modelName: "sessions", + fields: { + userId: "user_id", + expiresAt: "expires_at", + ipAddress: "ip_address", + userAgent: "user_agent", + createdAt: "created_at", + updatedAt: "updated_at", + }, expiresIn: 60 * 60 * 24 * 7, // 7 days updateAge: 60 * 60 * 24, // refresh after 1 day cookieCache: {