Skip to content

Commit 6f06512

Browse files
fix: fix error when no foreign key is found but foreign and primary key is detected (#632)
1 parent 208f230 commit 6f06512

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/adapters/sequelize.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ module.exports = (model, opts) => {
8787
const pkIsFk = primaryKeyIsForeignKey(association);
8888
if (pkIsFk) {
8989
const fk = fields.find((field) => field.reference === `${association.associationAccessor}.${association.foreignKey}`);
90-
fk.foreignAndPrimaryKey = true;
90+
if (fk) {
91+
fk.foreignAndPrimaryKey = true;
92+
}
9193
}
9294
});
9395

0 commit comments

Comments
 (0)