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

feat(prisma-adaper): update PrismaAdapter options to accept optional custom model names #12401

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ogroppo
Copy link

@ogroppo ogroppo commented Dec 18, 2024

☕️ Reasoning

If there are more tables with the same name e.g. User there is no way to work around it.
This is super typical if there are 2 auth systems in the same DB example platform users and admin users...

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

📌 Resources

@ogroppo ogroppo requested a review from ndom91 as a code owner December 18, 2024 22:26
Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ❌ Failed (Inspect) Dec 22, 2024 10:26pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Dec 22, 2024 10:26pm

Copy link

vercel bot commented Dec 18, 2024

@ogroppo is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters prisma @auth/prisma-adapter labels Dec 18, 2024
authenticatorModel?: string;
sessionModel?: string;
userModel?: string;
verificationTokenModel?: string;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just allow users to override the model name

@ndom91 ndom91 changed the title [prisma-adaper] Update PrismaAdapter to accept dynamic model names feat(prisma-adaper): update PrismaAdapter options to accept optional custom model names Dec 22, 2024
Comment on lines 37 to 40
const accountModel = p[options?.accountModel ?? "account"];
const authenticatorModel = p[options?.authenticatorModel ?? "authenticator"];
const sessionModel = p[options?.sessionModel ?? "session"];
const userModel = p[options?.userModel ?? "user"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to set up TS locally correctly, having a bunch of errors namely all args of methods have implicit any but I am not overriding the default tsconfig file afaik 🤔
Screenshot 2024-12-22 at 23 50 04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters prisma @auth/prisma-adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants