lucia-auth / lucia

Authentication, simple and clean
https://lucia-auth.com
MIT License
8.61k stars 448 forks source link

[Bug]: DrizzlePostgreSQLAdapter session table with default id not allowed #1401

Closed david-bermejo closed 5 months ago

david-bermejo commented 5 months ago

Package

lucia

Describe the bug

I am currently using ULIDs for pretty much every table identifier in my database. My project uses Drizzle ORM and PostgreSQL. When adding a default value to column id in sessions table, the following typescript error is generated: image

The sessions table has the following structure: image

To solve the error, it should be sufficient to just insert hasDefault: boolean; instead of hasDefault: false; in property id of type PostgreSQLSessionTable.

Note: the affected package is @lucia-auth/adapter-drizzle

pilcrowOnPaper commented 5 months ago

This is intended. Lucia does not support database generated values since it needs to know the created session ID and not all databases (e.g MySQL) return the generated ID when inserting.