diff --git a/packages/strapi-hook-bookshelf/lib/relations.js b/packages/strapi-hook-bookshelf/lib/relations.js index 19edd49851..0473e7b143 100644 --- a/packages/strapi-hook-bookshelf/lib/relations.js +++ b/packages/strapi-hook-bookshelf/lib/relations.js @@ -270,9 +270,11 @@ module.exports = { : null ); + const reverseAssoc = model.associations.find(assoc => assoc.alias === obj.field); + // Remove existing relationship because only one file // can be related to this field. - if (association.nature === 'manyMorphToOne') { + if (reverseAssoc && reverseAssoc.nature === 'oneToManyMorph') { relationUpdates.push( module.exports.removeRelationMorph .call(