You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Documentation mismatch? No type property on ForeignKeyOptions #13429
docsFor issues and PRs. Things related to documentation, such as changes in the manuals / API reference.good first issueFor issues. An issue that is a good choice for first-time contributors.
Working on a project I ran into the documentation for customizing the Foreign Key.
The docs read:
// https://sequelize.org/master/manual/assocs.html// For example, to use UUID as the foreign key data type instead of the default (INTEGER), you can simply do:const{ DataTypes }=require("Sequelize");Foo.hasOne(Bar,{foreignKey: {// name: 'myFooId'type: DataTypes.UUID}});Bar.belongsTo(Foo);
Good enough, but when I went to work on it, it threw an error :
Object literal may only specify known properties, and 'type' does not exist in type 'ForeignKeyOptions'
Looking at the files, it seems true. Is this correct behavior, missing type or incorrect documentation?
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
ModelAttributeColumnOptions extends ColumnOptions , so all the properties of ColumnOptions should be accessible via extending ModelAttributeColumnOptions.
Looks like extending ModelAttributeColumnOptions in ForeignKeyOptions would work, but I think creating intermediary type is a better option.
Correct me if I am wrong. Waiting for your inputs on this !
docsFor issues and PRs. Things related to documentation, such as changes in the manuals / API reference.good first issueFor issues. An issue that is a good choice for first-time contributors.
Activity
github-actions commentedon Oct 27, 2021
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
github-actions commentedon Nov 4, 2021
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
bera5186 commentedon Feb 27, 2022
Hey @Keimeno !! I would like to work on this issue. Please guide me with next steps.
ephys commentedon Feb 27, 2022
This would be a good point to start an investigation: https://github.com/sequelize/sequelize/blob/main/src/associations/base.d.ts#L37
ForeignKeyOptionsextendsColumnOptions, which doesn't includetypeThe only option bag that accepts
typeisModelAttributeColumnOptionsThe question is:
typebe moved fromModelAttributeColumnOptionstoColumnOptions(what other methods useColumnOptionsand do they accepttype)ModelAttributeColumnOptions? Does it support all of these optionsbera5186 commentedon Feb 27, 2022
Hey @ephys ,
ModelAttributeColumnOptionsextendsColumnOptions, so all the properties ofColumnOptionsshould be accessible via extendingModelAttributeColumnOptions.Looks like extending
ModelAttributeColumnOptionsinForeignKeyOptionswould work, but I think creating intermediary type is a better option.Correct me if I am wrong. Waiting for your inputs on this !
ephys commentedon Apr 16, 2022
#13429 fixes this issue