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(types): make Model.init
aware of pre-configured foreign keys
#14148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not knowledgeable enough to actually review the changes in src/model.d.ts but in general looks good. I am wondering however if we can't add some additional tests for this (apart from the one you've already added)
@WikiRik resolving the conflict dismissed your review 😅 |
Thank you! |
🎉 This PR is included in version 7.0.0-alpha.11 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR is for Sequelize v7, #14370 is v6
Pull Request Checklist
yarn test
oryarn test-DIALECT
pass with this change (including linting)?Description Of Change
Closes #14125
Model.init
currently requires a configuration for every declared attributes.Some attributes don't need to be configured by
Model.init
, these include:Project.belongsTo(User)
).I've resolved this by adding a new
ForeignKey<>
branded type (we're now at 3 branded types).This type tells
Model.init
that the attribute doesn't need to be included.I didn't include a solution for timestamp attributes, because the 'workaround' (which has been documented) is as simple and clearer than adding another branded type.
I've also included some documentation updates from #14091 that I want to cherry-pick in v6.