Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add model association override to @auth/sequelize-adapter #13120

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

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

Conversation

Copy link

@chipgpt chipgpt commented Jul 17, 2025
edited
Loading

☕️ Reasoning

I want to be able to customize the associations that are set up between the models when using the @auth/sequelize-adapter. This PR adds an optional override to the SequelizeAdapter options:

new SequelizeAdapter(sequelize, {
 models: {
 ...
 },
 associations: (User, Account, Session) => {
 Account.belongsTo(User, { onDelete: "cascade", foreignKey: "userId", as: 'user' });
 Session.belongsTo(User, { onDelete: "cascade", foreignKey: "userId", as: 'user' });
 }
});

🧢 Checklist

  • Documentation
  • Tests - There are no tests covering the associations.
  • Ready to be merged

🎫 Affected issues

📌 Resources

@chipgpt chipgpt requested a review from ndom91 as a code owner July 17, 2025 17:36
Copy link

vercel bot commented Jul 17, 2025
edited
Loading

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

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2025 5:48pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Jul 17, 2025 5:48pm

Copy link

vercel bot commented Jul 17, 2025

@chipgpt 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 sequelize @auth/sequelize-adapter labels Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@ndom91 ndom91 Awaiting requested review from ndom91 ndom91 is a code owner

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
adapters Changes related to the core code concerning database adapters sequelize @auth/sequelize-adapter
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /