feat(09-01): add theme column to user table + Better Auth additionalField

- migrations/084_add_user_theme.sql: ALTER TABLE user ADD COLUMN theme TEXT NOT NULL DEFAULT 'system'
- Defensive backfill UPDATE for in-flight NULL rows on managed Postgres
- COMMENT ON COLUMN documents allowed values (light|dark|system)
- lib/auth.ts: adds theme additionalField with defaultValue 'system' after timezone
- session.user.theme now exposed via Better Auth same as session.user.timezone
This commit is contained in:
lorentz 2026-05-10 07:22:26 -04:00
parent e5031e5613
commit 4fc4a3d3b9
2 changed files with 24 additions and 0 deletions

View file

@ -96,6 +96,10 @@ export const auth = betterAuth({
type: "string",
defaultValue: process.env.DEFAULT_TIMEZONE || "UTC",
},
theme: {
type: "string",
defaultValue: "system",
},
},
},
});