lucia-auth / lucia

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

[Feature Request]: Customizable column name in adapters #1393

Closed t6adev closed 7 months ago

t6adev commented 7 months ago

Package

​@lucia-auth/adapter-mysql

Description

Hi! I'm glad to use Lucia instead of NextAuth anyway I'm a newbie to Lucia.

Context

First, I was facing an issue of Unknown column \'user_id\' when confirming GitHub oauth behavior. I found out my session table has userId instead of user_id. In my project, the database schema is generated by prisma-kysely for PlanetScale. Then I prepared an adapter using @lucia-auth/adapter-mysql.

Suggestion

This supports to definition of table names by constractor. https://github.com/lucia-auth/lucia/blob/b7f1800b5fce76aa92a9e857d39a33b26fdf6f44/packages/adapter-mysql/src/base.ts#L17-L18 As same this, it is comfortable to integrate database if it will be able to define column names.

or

I'd be happy if it had an option that it's like a flag to switch camelCase or snake_case for columns.

Thanks.

pilcrowOnPaper commented 7 months ago

I'd create a custom adapter instead. It should be fairly simple in v3.