Using email/username as a primary key #45
-
Hi @pilcrowonpaper, I haven't start using it yet, but I probably will, one question: looking at the database schema (https://lucia-sveltekit.vercel.app/adapters) it is not very clear if username/email can be used as a primary key. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can use |
Beta Was this translation helpful? Give feedback.
-
What is the main purpose of primary key? |
Beta Was this translation helpful? Give feedback.
You can use
"username"
as the auth id and the email the identifier token, and have a separateusername
andemail
column (unique) (these are represented as[user_id]
columns in the docs). Lucia will throw an error if the username or email is already taken.