Closed deadcoder0904 closed 7 months ago
Default database values are not supported in Lucia
id: text('id')
.primaryKey()
.$defaultFn(() => ulid()) // here
Instead, manually generate and pass the ID when creating the user
db.insertInto(userTable).values({
id: ulid()
})
@pilcrowOnPaper it works for userTable
by default. it doesn't work for sessionTable
.
even works for emailVerificationTokenTable
. probably bcz lucia only requires 2 tables: userTable
& sessionTable
.
i don't think i can pass ulid()
to sessionTable
in any way as it gets set via lucia.createSession()
i think.
Yeah session ID can't be altered
I learned about
ulidx
today & tried using it in allid
's by default like this:The first one in
userTable
works fine but the second one insessionTable
gives me this error:I get this error on
sessionTable
here:I found the source to be:
https://github.com/lucia-auth/lucia/blob/ac8b7750dcc2beb039c72993720ea54f59007bf1/packages/adapter-drizzle/src/drivers/sqlite.ts#L142
Curious, why is it set to
false
? It means we can't pass a defaultid
tosession
. What if we want to passulid
like I did above? I think setting it toboolean
might get the same result, no? Unless its used in someplaces Idk.Just a minor gripe because all my ids used
ulid
so I thought this one should too for consistencies sake.