You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was following the docs to put together a SvelteKit project using DrizzleORM and all was going super well until I started adding additional attributes to my users.
While I can see the quick solution is to just make the column names match the property names, I've seen instances where people expect those to be independent, especially when the ORM allows you to customize them independently.
It would probably be a good idea to update the docs to mention this behavior in the Users documentation
// create user with username methodconstuser=awaitauth.createUser({key: {providerId: 'username',
password,// lowercase to ensure uniquenessproviderUserId: username.toLowerCase(),},attributes: {
username,role: 'user',darkTheme: 'dark',lightTheme: 'light',},})
works
typeUser=import('$lib/server').User
...
namespaceLucia{typeAuth=import('$lib/server').Auth/** * these have to match the _database_ column names, not what you called them * in Drizzle's config */typeDatabaseUserAttributes={username: User['username']light_theme: User['lightTheme']dark_theme: User['darkTheme']role: User['role']}typeDatabaseSessionAttributes=NonNullable<unknown>}
// create user with username methodconstuser=awaitauth.createUser({key: {providerId: 'username',
password,// lowercase to ensure uniquenessproviderUserId: username.toLowerCase(),},attributes: {
username,role: 'user',dark_theme: 'dark',light_theme: 'light',},})
The text was updated successfully, but these errors were encountered:
Description
I was following the docs to put together a SvelteKit project using DrizzleORM and all was going super well until I started adding additional attributes to my users.
While I can see the quick solution is to just make the column names match the property names, I've seen instances where people expect those to be independent, especially when the ORM allows you to customize them independently.
It would probably be a good idea to update the docs to mention this behavior in the Users documentation
my user
does not work
works
The text was updated successfully, but these errors were encountered: