Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V3] Allow custom adapters #2913

Open
ineshbose opened this issue Dec 13, 2024 · 0 comments
Open

[V3] Allow custom adapters #2913

ineshbose opened this issue Dec 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ineshbose
Copy link
Member

ineshbose commented Dec 13, 2024

Is your feature request related to a problem? Please describe

Since V3 is SQL based and provides presets for what DB, it would be quite great if devs can provide their own adapters (especially when someone may be using Drizzle, Prisma, etc). This also enables a lot more control over how collections can integrate into existing databases.

Describe the solution you'd like

I definitely do not propose providing custom adapter implementation within the module as it would require lot of maintenance. Instead, if there is a file like content.adapter.ts, we load that into #content/adapter.

A couple of things we'd need to do additionally:

  1. Expose createDatabaseAdapter.
  2. Do you think we can do away with adapter.exec? We should rather follow this format for adapters: https://github.com/better-auth/better-auth/blob/9e56ea2e325b916cbbca24f0478bf91484bf7668/packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts#L248 https://github.com/better-auth/better-auth/blob/9e56ea2e325b916cbbca24f0478bf91484bf7668/packages/better-auth/src/types/adapter.ts#L26
  3. If we keep exec, we may need to allow collection configuration to specify tableName (or we provide instructions that devs configure their ORM to match __content_${name}, but that defeats the purpose)

Describe alternatives you've considered

Additional context

Willing to raise a PR -- need your thoughts first!

@ineshbose ineshbose added the enhancement New feature or request label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant